Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up: more {{partial}} cleanup after removal #1349

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/@glimmer/interfaces/lib/template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export interface LayoutWithContext {
readonly owner: Owner | null;
readonly scope: (() => unknown[]) | undefined | null;
readonly isStrictMode: boolean;
readonly asPartial: boolean;
}

export interface BlockWithContext {
Expand All @@ -40,7 +39,6 @@ export interface TemplateOk {

// internal casts, these are lazily created and cached
asLayout(): CompilableProgram;
asPartial(): CompilableProgram;
asWrappedLayout(): CompilableProgram;
}

Expand Down Expand Up @@ -95,7 +93,6 @@ export interface NamedBlocks {
}

export interface ContainingMetadata {
asPartial: boolean;
evalSymbols: Option<string[]>;
upvars: Option<string[]>;
scopeValues: unknown[] | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,9 @@ export function encodeOp(
freeVar
];

if (meta.asPartial === true) {
encoder.push(constants, Op.ResolveMaybeLocal, name);
} else {
let then = op[2];
let andThen = op[2];

then(name, meta.moduleName);
}
andThen(name, meta.moduleName);

break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export function meta(layout: LayoutWithContext): ContainingMetadata {
let [, symbols, , upvars] = layout.block;

return {
asPartial: layout.asPartial || false,
evalSymbols: evalSymbols(layout),
upvars: upvars,
scopeValues: layout.scope?.() ?? null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export function compileStd(context: CompileTimeCompilationContext): StdLib {
}

const STDLIB_META = {
asPartial: false,
evalSymbols: null,
upvars: null,
moduleName: 'stdlib',
Expand Down
24 changes: 3 additions & 21 deletions packages/@glimmer/opcode-compiler/lib/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ class TemplateImpl implements TemplateWithIdAndReferrer {
readonly result = 'ok';

private layout: Option<CompilableProgram> = null;
private partial: Option<CompilableProgram> = null;
private wrappedLayout: Option<CompilableProgram> = null;

constructor(private parsedLayout: Omit<LayoutWithContext, 'asPartial'>) {}
constructor(private parsedLayout: LayoutWithContext) {}

get moduleName() {
return this.parsedLayout.moduleName;
Expand All @@ -128,30 +127,13 @@ class TemplateImpl implements TemplateWithIdAndReferrer {

asLayout(): CompilableProgram {
if (this.layout) return this.layout;
return (this.layout = compilable(
assign({}, this.parsedLayout, {
asPartial: false,
}),
this.moduleName
));
}

asPartial(): CompilableProgram {
if (this.partial) return this.partial;
return (this.partial = compilable(
assign({}, this.parsedLayout, {
asPartial: true,
}),
this.moduleName
));
return (this.layout = compilable(assign({}, this.parsedLayout), this.moduleName));
}

asWrappedLayout(): CompilableProgram {
if (this.wrappedLayout) return this.wrappedLayout;
return (this.wrappedLayout = new WrappedBuilder(
assign({}, this.parsedLayout, {
asPartial: false,
}),
assign({}, this.parsedLayout),
this.moduleName
));
}
Expand Down