diff --git a/guides/01-introduction.md b/guides/01-introduction.md index 84738f384e..272c56e03a 100644 --- a/guides/01-introduction.md +++ b/guides/01-introduction.md @@ -17,7 +17,7 @@ Glimmer is a flexible, low-level rendering pipeline for building a "live" DOM from a superset of the [Handlebars][handlebars] templating language that can subsequently be updated cheaply when data changes. -In addition to the basic Handlebars features such as helpers and partials, +In addition to the basic Handlebars features such as helpers, Glimmer also comes with built-in support for a very flexible and powerful primitive called "Components" and a set of low-level hooks which the host environment can use to build other high-level, user-facing features. diff --git a/guides/11-glossary.md b/guides/11-glossary.md index d765a24a08..ae704d6b52 100644 --- a/guides/11-glossary.md +++ b/guides/11-glossary.md @@ -269,20 +269,6 @@ See also: [Reference](#reference), [References (guide)][path-reference-guide] [path-reference-guide]: ./04-references.md#references-in-glimmer -## Partial - -A partial is a kind of non-component template that can be included inside other -templates, inheriting the lexical scope of its surrounding environment. - -Similar to `eval()` in JavaScript, it behaves as though you copied and pasted -the partial's template into the parent template, inheriting all of the variables -in scope. Also like `eval()`, its highly dynamic nature disables many categories -of optimization wherever it is used. - -Using partials is discouraged. They are implemented for backwards compatibility -with Ember and should not be used in new host environments. Everything that can -be accomplished with a partial can be better accomplished with a component. - ## Constant Pool The constant pool is a data structure that contains arrays of JavaScript values diff --git a/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts b/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts index 24223d337f..d0791c2176 100644 --- a/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts +++ b/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts @@ -82,7 +82,6 @@ export default function createRegistry(): Registry { lookupHelper: (name) => helpers.get(name) ?? null, lookupModifier: (name) => modifiers.get(name) ?? null, lookupComponent: (name) => components.get(name) ?? null, - lookupPartial: () => null, lookupBuiltInHelper: () => null, lookupBuiltInModifier: () => null, @@ -97,7 +96,6 @@ export default function createRegistry(): Registry { context, { lookupComponent: () => null, - lookupPartial: () => null, }, component, args, diff --git a/packages/@glimmer/compiler/lib/PASSES.md b/packages/@glimmer/compiler/lib/PASSES.md index a3003e7399..f036a78874 100644 --- a/packages/@glimmer/compiler/lib/PASSES.md +++ b/packages/@glimmer/compiler/lib/PASSES.md @@ -14,7 +14,7 @@ The input to the preprocessor is _the AST_. The AST is the result of parsing a t In addition to allocating symbols for variable references that refer to in-scope bindings (introduced by block parameters), this pass also allocates symbols for `@arg` references, as well as blocks that are references via the `{{yield}}`, `(has-block)` and `(has-block-params)` keywords. -Finally, this pass is responsible for identifying the presence of the `{{partial}}` and `{{debugger}}` keywords, which require symbol maps at runtime. +Finally, this pass is responsible for identifying the presence of the `{{debugger}}` keyword, which require symbol maps at runtime. **Encoding**: The encoding pass turns the MIR into the wire format, which is suitable for wire transport. The current encoding pass is hardcoded to emit the wire format (documented in `@glimmer/wire-format`). This is the stage where any optimizations on the representation are performed (like erasing trailing nulls, or other simple packing optimizations). diff --git a/packages/@glimmer/compiler/lib/builder/builder-interface.ts b/packages/@glimmer/compiler/lib/builder/builder-interface.ts index 201d1afa66..0e96aa41ab 100644 --- a/packages/@glimmer/compiler/lib/builder/builder-interface.ts +++ b/packages/@glimmer/compiler/lib/builder/builder-interface.ts @@ -56,8 +56,7 @@ export interface Variable { * * - strict mode variables always refer to in-scope variables * - loose mode variables use this algorithm: - * 1. if the template is invoked as a partial, look for an in-scope partial variable - * 2. otherwise, fall back to `this.` + * 1. otherwise, fall back to `this.` */ mode: 'loose' | 'strict'; } diff --git a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts index 885b6edb45..938fc35ef2 100644 --- a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts +++ b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts @@ -1,6 +1,5 @@ import { CurriedType } from '@glimmer/interfaces'; import { ASTv2, generateSyntaxError, SourceSlice, SourceSpan } from '@glimmer/syntax'; -import { expect } from '@glimmer/util'; import { Err, Ok, Result } from '../../../shared/result'; import * as mir from '../../2-encoding/mir'; @@ -75,75 +74,6 @@ export const APPEND_KEYWORDS = keywords('Append') ); }, }) - .kw('partial', { - assert( - node: ASTv2.AppendContent, - state: NormalizationState - ): Result { - if (state.isStrict) { - return Err( - generateSyntaxError('{{partial}} is not allowed in strict mode templates', node.loc) - ); - } - - let { - args: { positional, named }, - } = node; - let { trusting } = node; - - if (positional.isEmpty()) { - return Err( - generateSyntaxError( - `Partial found with no arguments. You must specify a template name`, - node.loc - ) - ); - } else if (positional.size !== 1) { - return Err( - generateSyntaxError( - `Partial found with ${positional.exprs.length} arguments. You must specify a template name`, - node.loc - ) - ); - } - - if (named.isEmpty()) { - if (trusting) { - return Err( - generateSyntaxError( - `{{{partial ...}}} is not supported, please use {{partial ...}} instead`, - node.loc - ) - ); - } - - return Ok(expect(positional.nth(0), `already confirmed that positional has a 0th entry`)); - } else { - return Err(generateSyntaxError(`Partial does not take any named argument`, node.loc)); - } - }, - - translate( - { node, state }: { node: ASTv2.AppendContent; state: NormalizationState }, - expr: ASTv2.ExpressionNode | undefined - ): Result { - state.scope.setHasEval(); - - let visited = - expr === undefined - ? Ok( - new ASTv2.LiteralExpression({ - loc: SourceSpan.synthetic('undefined'), - value: undefined, - }) - ) - : VISIT_EXPRS.visit(expr, state); - - return visited.mapOk( - (target) => new mir.Partial({ loc: node.loc, scope: state.scope, target }) - ); - }, - }) .kw('debugger', { assert(node: ASTv2.AppendContent): Result { let { args } = node; diff --git a/packages/@glimmer/compiler/lib/passes/2-encoding/content.ts b/packages/@glimmer/compiler/lib/passes/2-encoding/content.ts index 99ceed9ee4..2eda7fdbdd 100644 --- a/packages/@glimmer/compiler/lib/passes/2-encoding/content.ts +++ b/packages/@glimmer/compiler/lib/passes/2-encoding/content.ts @@ -44,8 +44,6 @@ export class ContentEncoder { switch (stmt.type) { case 'Debugger': return [SexpOpcodes.Debugger, stmt.scope.getEvalInfo()]; - case 'Partial': - return this.Partial(stmt); case 'AppendComment': return this.AppendComment(stmt); case 'AppendTextNode': @@ -79,10 +77,6 @@ export class ContentEncoder { } } - Partial({ target, scope }: mir.Partial): WireFormat.Statements.Partial { - return [SexpOpcodes.Partial, EXPR.expr(target), scope.getEvalInfo()]; - } - Yield({ to, positional }: mir.Yield): WireFormat.Statements.Yield { return [SexpOpcodes.Yield, to, EXPR.Positional(positional)]; } diff --git a/packages/@glimmer/compiler/lib/passes/2-encoding/mir.ts b/packages/@glimmer/compiler/lib/passes/2-encoding/mir.ts index 409291b1a8..d95ca344c6 100644 --- a/packages/@glimmer/compiler/lib/passes/2-encoding/mir.ts +++ b/packages/@glimmer/compiler/lib/passes/2-encoding/mir.ts @@ -136,10 +136,6 @@ export class Yield extends node('Yield').fields<{ to: number; positional: Positional; }>() {} -export class Partial extends node('Partial').fields<{ - target: ExpressionNode; - scope: SymbolTable; -}>() {} export class Debugger extends node('Debugger').fields<{ scope: SymbolTable }>() {} export class CallExpression extends node('CallExpression').fields<{ @@ -243,7 +239,6 @@ export type Statement = | Component | SimpleElement | InvokeBlock - | Partial | AppendComment | If | Each diff --git a/packages/@glimmer/compiler/lib/wire-format-debug.ts b/packages/@glimmer/compiler/lib/wire-format-debug.ts index 6e34c4f535..cdfe24ed87 100644 --- a/packages/@glimmer/compiler/lib/wire-format-debug.ts +++ b/packages/@glimmer/compiler/lib/wire-format-debug.ts @@ -94,9 +94,6 @@ export default class WireFormatDebugger { case Op.Yield: return ['yield', opcode[1], this.formatParams(opcode[2])]; - case Op.Partial: - return ['partial', this.formatOpcode(opcode[1]), opcode[2]]; - case Op.DynamicArg: return ['dynamic-arg', opcode[1], this.formatOpcode(opcode[2])]; diff --git a/packages/@glimmer/debug/lib/opcode-metadata.ts b/packages/@glimmer/debug/lib/opcode-metadata.ts index 3760b1245f..fac182ec63 100644 --- a/packages/@glimmer/debug/lib/opcode-metadata.ts +++ b/packages/@glimmer/debug/lib/opcode-metadata.ts @@ -1302,29 +1302,6 @@ METADATA[Op.DidRenderLayout] = { check: true, }; -METADATA[Op.InvokePartial] = { - name: 'InvokePartial', - mnemonic: 'invokepartial', - before: null, - stackChange: 1, - ops: [ - { - name: 'owner', - type: 'owner', - }, - { - name: 'symbols', - type: 'str-array', - }, - { - name: 'evalInfo', - type: 'array', - }, - ], - operands: 3, - check: true, -}; - METADATA[Op.ResolveMaybeLocal] = { name: 'ResolveMaybeLocal', mnemonic: 'eval_varload', diff --git a/packages/@glimmer/integration-tests/lib/modes/jit/compilation-context.ts b/packages/@glimmer/integration-tests/lib/modes/jit/compilation-context.ts index bfd8220e9d..86d58642a1 100644 --- a/packages/@glimmer/integration-tests/lib/modes/jit/compilation-context.ts +++ b/packages/@glimmer/integration-tests/lib/modes/jit/compilation-context.ts @@ -2,7 +2,6 @@ import { CompileTimeResolver, Option, ResolvedComponentDefinition, - PartialDefinition, HelperDefinitionState, ModifierDefinitionState, } from '@glimmer/interfaces'; @@ -23,10 +22,6 @@ export default class JitCompileTimeLookup implements CompileTimeResolver { return this.resolver.lookupComponent(name, owner); } - lookupPartial(name: string): Option { - return this.resolver.lookupPartial(name); - } - lookupBuiltInHelper(_name: string): Option { return null; } diff --git a/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts b/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts index f3da681b27..87ebbd7bb3 100644 --- a/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts +++ b/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts @@ -52,7 +52,6 @@ import { registerHelper, registerInternalHelper, registerModifier, - registerPartial, } from './register'; import { TestJitRegistry } from './registry'; import { renderTemplate } from './render'; @@ -185,10 +184,6 @@ export class JitRenderDelegate implements RenderDelegate { return clientBuilder(env, cursor); } - registerPartial(name: string, content: string) { - registerPartial(this.registry, name, content); - } - getSelf(_env: Environment, context: unknown): Reference { if (!this.self) { this.self = createConstRef(context, 'this'); diff --git a/packages/@glimmer/integration-tests/lib/modes/jit/register.ts b/packages/@glimmer/integration-tests/lib/modes/jit/register.ts index e08f97046a..5ea1c4ffa0 100644 --- a/packages/@glimmer/integration-tests/lib/modes/jit/register.ts +++ b/packages/@glimmer/integration-tests/lib/modes/jit/register.ts @@ -3,7 +3,6 @@ import { Option, Helper as GlimmerHelper, InternalModifierManager, - PartialDefinition, TemplateFactory, ResolutionTimeConstants, CurriedType, @@ -16,10 +15,9 @@ import { TestModifierDefinitionState, TestModifierManager, } from '../../modifiers'; -import { PartialDefinitionImpl } from '@glimmer/opcode-compiler'; import { ComponentKind, ComponentTypes } from '../../components'; import { CurriedValue, curry, templateOnlyComponent } from '@glimmer/runtime'; -import { createTemplate, preprocess } from '../../compile'; +import { createTemplate } from '../../compile'; import { getInternalComponentManager, setComponentTemplate, @@ -108,16 +106,6 @@ export function registerModifier( registry.register('modifier', name, state); } -export function registerPartial( - registry: TestJitRegistry, - name: string, - source: string -): PartialDefinition { - let definition = new PartialDefinitionImpl(name, preprocess(source)); - registry.register('partial', name, definition); - return definition; -} - export function registerComponent( registry: TestJitRegistry, type: K, diff --git a/packages/@glimmer/integration-tests/lib/modes/jit/registry.ts b/packages/@glimmer/integration-tests/lib/modes/jit/registry.ts index 8d6f48668c..8f3bc2eafd 100644 --- a/packages/@glimmer/integration-tests/lib/modes/jit/registry.ts +++ b/packages/@glimmer/integration-tests/lib/modes/jit/registry.ts @@ -3,7 +3,6 @@ import { ResolvedComponentDefinition, Invocation, Option, - PartialDefinition, Template, HelperDefinitionState, ModifierDefinitionState, @@ -22,7 +21,6 @@ CIRCULAR_OBJECT.inner.outer = CIRCULAR_OBJECT; export interface Lookup { helper: HelperDefinitionState; modifier: ModifierDefinitionState; - partial: PartialDefinition; component: ResolvedComponentDefinition; template: Invocation; compilable: Template; @@ -51,7 +49,6 @@ export class TypedRegistry { export default class Registry { helper = new TypedRegistry(); modifier = new TypedRegistry(); - partial = new TypedRegistry(); component = new TypedRegistry< ResolvedComponentDefinition >(); diff --git a/packages/@glimmer/integration-tests/lib/modes/jit/resolver.ts b/packages/@glimmer/integration-tests/lib/modes/jit/resolver.ts index 6591cce1bb..1dddaa972f 100644 --- a/packages/@glimmer/integration-tests/lib/modes/jit/resolver.ts +++ b/packages/@glimmer/integration-tests/lib/modes/jit/resolver.ts @@ -2,7 +2,6 @@ import { RuntimeResolver, Option, ResolvedComponentDefinition, - PartialDefinition, ModifierDefinitionState, HelperDefinitionState, } from '@glimmer/interfaces'; @@ -22,8 +21,4 @@ export class TestJitRuntimeResolver implements RuntimeResolver { lookupComponent(name: string, _owner?: object): Option { return this.registry.lookupComponent(name); } - - lookupPartial(name: string): Option { - return this.registry.lookup('partial', name); - } } diff --git a/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts b/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts index 0fdc388d16..c27c1431d1 100644 --- a/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts +++ b/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts @@ -32,7 +32,6 @@ import { registerHelper, registerInternalHelper, registerModifier, - registerPartial, } from '../jit/register'; import { TestJitRegistry } from '../jit/registry'; import { renderTemplate } from '../jit/render'; @@ -196,11 +195,6 @@ export class RehydrationDelegate implements RenderDelegate { registerInternalHelper(this.serverRegistry, name, helper); } - registerPartial(name: string, content: string) { - registerPartial(this.clientRegistry, name, content); - registerPartial(this.serverRegistry, name, content); - } - registerModifier(name: string, ModifierClass: TestModifierConstructor): void { registerModifier(this.clientRegistry, name, ModifierClass); registerModifier(this.serverRegistry, name, ModifierClass); diff --git a/packages/@glimmer/integration-tests/lib/render-delegate.ts b/packages/@glimmer/integration-tests/lib/render-delegate.ts index 7c4e079cb7..e831b275c6 100644 --- a/packages/@glimmer/integration-tests/lib/render-delegate.ts +++ b/packages/@glimmer/integration-tests/lib/render-delegate.ts @@ -41,7 +41,6 @@ export default interface RenderDelegate { registerPlugin(plugin: ASTPluginBuilder): void; registerHelper(name: string, helper: UserHelper): void; registerInternalHelper(name: string, helper: Helper): void; - registerPartial(name: string, content: string): void; registerModifier(name: string, klass: unknown): void; renderTemplate( template: string, diff --git a/packages/@glimmer/integration-tests/lib/render-test.ts b/packages/@glimmer/integration-tests/lib/render-test.ts index 25e3883ec2..9fb4e00b99 100644 --- a/packages/@glimmer/integration-tests/lib/render-test.ts +++ b/packages/@glimmer/integration-tests/lib/render-test.ts @@ -80,10 +80,6 @@ export class RenderTest implements IRenderTest { this.delegate.registerModifier(name, ModifierClass); } - registerPartial(name: string, content: string): void { - this.delegate.registerPartial(name, content); - } - registerComponent( type: K, name: string, diff --git a/packages/@glimmer/integration-tests/test/partial-test.ts b/packages/@glimmer/integration-tests/test/partial-test.ts deleted file mode 100644 index 0e176f3387..0000000000 --- a/packages/@glimmer/integration-tests/test/partial-test.ts +++ /dev/null @@ -1,655 +0,0 @@ -import { EmberishCurlyComponent, strip, RenderTest, test, jitSuite } from '..'; -import { assert } from './support'; -import { expect } from '@glimmer/util'; - -class PartialTest extends RenderTest { - static suiteName = 'Partials'; - - assertInvariants() { - let result = expect(this.renderResult, 'must render before asserting invariants'); - - QUnit.assert.strictEqual( - result.firstNode(), - this.element.firstChild, - "The firstNode of the result is the same as the context.root's firstChild" - ); - QUnit.assert.strictEqual( - result.lastNode(), - this.element.lastChild, - "The lastNode of the result is the same as the context.root's lastChild" - ); - } - - @test - 'static partial with static content'() { - this.registerPartial('test', `
Testing
`); - this.render(`Before {{partial 'test'}} After`); - - this.assertHTML(`Before
Testing
After`); - this.assertStableRerender(); - this.assertHTML(`Before
Testing
After`); - } - - @test - 'static partial with self reference'() { - this.registerPartial( - 'birdman', - `Respeck my {{item}}. When my {{item}} come up put some respeck on it.` - ); - this.render(`{{partial 'birdman'}}`, { item: 'name' }); - - this.assertStableRerender(); - - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - this.rerender({ item: 'name' }); - this.assertStableNodes(); - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - } - - @test - 'static partial with local reference'() { - this.registerPartial('test', `You {{quality.value}}`); - this.render(`{{#each this.qualities key='id' as |quality|}}{{partial 'test'}}. {{/each}}`, { - qualities: [ - { id: 1, value: 'smaht' }, - { id: 2, value: 'loyal' }, - ], - }); - - this.assertStableRerender(); - - this.assertHTML(`You smaht. You loyal. `); - this.rerender({ - qualities: [ - { id: 1, value: 'smaht' }, - { id: 2, value: 'loyal' }, - ], - }); - this.assertStableNodes(); - this.assertHTML(`You smaht. You loyal. `); - } - - @test - 'static partial with local reference (unknown)'() { - this.registerPartial('test', `You {{quality}}`); - this.render(`{{#each this.qualities key='@index' as |quality|}}{{partial 'test'}}. {{/each}}`, { - qualities: ['smaht', 'loyal'], - }); - - this.assertStableRerender(); - - this.assertHTML(`You smaht. You loyal. `); - this.rerender({ qualities: ['smaht', 'loyal'] }); - this.assertStableNodes(); - this.assertHTML(`You smaht. You loyal. `); - } - - @test - 'static partial with named arguments'() { - this.registerComponent('Glimmer', 'FooBar', `

{{@foo}}-{{partial 'test'}}

`); - - this.registerPartial('test', `{{@foo}}-{{@bar}}`); - this.render(``, { foo: 'foo', bar: 'bar' }); - this.assertHTML(`

foo-foo-bar

`); - - this.assertStableRerender(); - - this.rerender({ foo: 'FOO', bar: 'BAR' }); - this.assertStableNodes(); - this.assertHTML(`

FOO-FOO-BAR

`); - - this.rerender({ foo: 'foo', bar: 'bar' }); - this.assertStableNodes(); - this.assertHTML(`

foo-foo-bar

`); - } - - @test - 'static partial with has-block in basic component'() { - this.registerComponent('Glimmer', 'FooBar', `

{{partial 'test'}}

`); - this.registerComponent( - 'Glimmer', - 'FooBarBaz', - `

{{partial 'test'}}-{{has-block}}-{{has-block 'inverse'}}

` - ); - this.registerPartial('test', `{{has-block}}-{{has-block 'inverse'}}`); - - this.render(strip` - a block - - a block - - `); - - this.assertHTML( - strip` -

true-false

-

false-false

-

true-false-true-false

-

false-false-false-false

- ` - ); - - this.assertStableRerender(); - } - - @test - 'static partial with has-block in curly component'() { - class TaglessComponent extends EmberishCurlyComponent { - tagName = ''; - } - - this.registerComponent( - 'Curly', - 'foo-bar', - `

{{partial 'test'}}

`, - class extends TaglessComponent {} - ); - this.registerComponent( - 'Curly', - 'foo-bar-baz', - `

{{partial 'test'}}-{{has-block}}-{{has-block 'inverse'}}

`, - class extends TaglessComponent {} - ); - this.registerPartial('test', `{{has-block}}-{{has-block 'inverse'}}`); - - this.render( - strip` - {{#foo-bar}}a block{{/foo-bar}} - {{#foo-bar}}a block{{else}}inverse{{/foo-bar}} - {{foo-bar}} - {{#foo-bar-baz}}a block{{/foo-bar-baz}} - {{#foo-bar-baz}}a block{{else}}inverse{{/foo-bar-baz}} - {{foo-bar-baz}} - ` - ); - - this.assertHTML( - strip` -

true-false

-

true-true

-

false-false

-

true-false-true-false

-

true-true-true-true

-

false-false-false-false

- ` - ); - - this.assertStableRerender(); - } - - @test - 'static partial with has-block-params in basic component'() { - this.registerComponent('Glimmer', 'FooBar', `

{{partial 'test'}}

`); - this.registerComponent( - 'Glimmer', - 'FooBarBaz', - `

{{partial 'test'}}-{{has-block-params}}-{{has-block-params "inverse"}}

` - ); - this.registerPartial('test', `{{has-block-params}}-{{has-block-params "inverse"}}`); - - this.render( - strip` - a block - a block - - a block - a block - - ` - ); - - this.assertHTML( - strip` -

true-false

-

false-false

-

false-false

-

true-false-true-false

-

false-false-false-false

-

false-false-false-false

- ` - ); - - this.assertStableRerender(); - } - - @test - 'static partial with has-block-params in curly component'() { - class TaglessComponent extends EmberishCurlyComponent { - tagName = ''; - } - - this.registerComponent( - 'Curly', - 'foo-bar', - `

{{partial 'test'}}

`, - class extends TaglessComponent {} - ); - this.registerComponent( - 'Curly', - 'foo-bar-baz', - `

{{partial 'test'}}-{{has-block-params}}-{{has-block-params "inverse"}}

`, - class extends TaglessComponent {} - ); - this.registerPartial('test', `{{has-block-params}}-{{has-block-params "inverse"}}`); - - this.render( - strip` - {{#foo-bar as |x|}}a block{{/foo-bar}} - {{#foo-bar}}a block{{else}}inverse{{/foo-bar}} - {{#foo-bar}}a block{{/foo-bar}} - {{foo-bar}} - {{#foo-bar-baz as |x|}}a block{{/foo-bar-baz}} - {{#foo-bar-baz}}a block{{else}}inverse{{/foo-bar-baz}} - {{#foo-bar-baz}}a block{{/foo-bar-baz}} - {{foo-bar-baz}} - ` - ); - - this.assertHTML( - strip` -

true-false

-

false-false

-

false-false

-

false-false

-

true-false-true-false

-

false-false-false-false

-

false-false-false-false

-

false-false-false-false

- ` - ); - - this.assertStableRerender(); - } - - @test - 'static partial with yield in basic component'() { - this.registerComponent('Glimmer', 'FooBar', `

{{partial 'test'}}

`); - this.registerComponent( - 'Glimmer', - 'FooBarBaz', - `

{{partial 'test'}}-{{yield "layout"}}-{{yield to='inverse'}}

` - ); - this.registerPartial('test', `{{yield "partial"}}-{{yield to='inverse'}}`); - - this.render( - strip` - from {{source}} - - from {{source}} - - ` - ); - - this.assertHTML( - strip` -

from partial-

-

-

-

from partial--from layout-

-

---

- ` - ); - - this.assertStableRerender(); - } - - @test - 'static partial with yield in curly component'() { - class TaglessComponent extends EmberishCurlyComponent { - tagName = ''; - } - - this.registerComponent( - 'Curly', - 'foo-bar', - `

{{partial 'test'}}

`, - class extends TaglessComponent {} - ); - this.registerComponent( - 'Curly', - 'foo-bar-baz', - `

{{partial 'test'}}-{{yield "layout"}}-{{yield to='inverse'}}

`, - class extends TaglessComponent {} - ); - this.registerPartial('test', `{{yield "partial"}}-{{yield to='inverse'}}`); - - this.render( - strip` - {{#foo-bar as |source|}}from {{source}}{{/foo-bar}} - {{#foo-bar as |source|}}from {{source}}{{else}}inverse{{/foo-bar}} - {{foo-bar}} - {{#foo-bar-baz as |source|}}from {{source}}{{/foo-bar-baz}} - {{#foo-bar-baz as |source|}}from {{source}}{{else}}inverse{{/foo-bar-baz}} - {{foo-bar-baz}} - ` - ); - - this.assertHTML( - strip` -

from partial-

-

from partial-inverse

-

-

-

from partial--from layout-

-

from partial-inverse-from layout-inverse

-

---

- ` - ); - - this.assertStableRerender(); - } - - @test - 'dynamic partial with static content'() { - this.registerPartial('test', `
Testing
`); - this.render(`Before {{partial this.name}} After`, { name: 'test' }); - - this.assertHTML(`Before
Testing
After`); - this.rerender({ name: 'test' }); - this.assertStableNodes(); - this.assertHTML(`Before
Testing
After`); - } - - @test - 'nested dynamic partial with dynamic content'() { - this.registerPartial('test', `
Testing {{this.wat}} {{partial this.nest}}
`); - this.registerPartial('nested', `
Nested {{this.lol}}
`); - - this.render(`Before {{partial this.name}} After`, { - name: 'test', - nest: 'nested', - wat: 'wat are', - lol: 'you doing?', - }); - - this.assertHTML(`Before
Testing wat are
Nested you doing?
After`); - this.rerender({ name: 'test', nest: 'nested', wat: 'wat are', lol: 'you doing?' }); - this.assertStableNodes(); - this.assertHTML(`Before
Testing wat are
Nested you doing?
After`); - } - - @test - 'nested partials within nested `{{#with}}` blocks'() { - this.registerPartial( - 'person2-partial', - `{{#with 'Ben' as |person2|}}Hi {{person1}} (aged {{age}}), {{person2}}, {{person3}} and {{person4}}. {{partial 'person3-partial'}}{{/with}}` - ); - this.registerPartial( - 'person3-partial', - `{{#with 'Alex' as |person3|}}Hi {{person1}} (aged {{age}}), {{person2}}, {{person3}} and {{person4}}. {{partial 'person4-partial'}}{{/with}}` - ); - this.registerPartial( - 'person4-partial', - `{{#with 'Sarah' as |person4|}}Hi {{person1}} (aged {{age}}), {{person2}}, {{person3}} and {{person4}}.{{/with}}` - ); - - this.render( - `Hi {{this.person1}}. {{#with 'Sophie' as |person1|}}Hi {{person1}} (aged {{this.age}}), {{this.person2}}, {{this.person3}} and {{this.person4}}. {{partial 'person2-partial'}}{{/with}}`, - { - person1: 'Context1', - person2: 'Context2', - person3: 'Context3', - person4: 'Context4', - age: 0, - } - ); - - this.assertHTML( - `Hi Context1. Hi Sophie (aged 0), Context2, Context3 and Context4. Hi Sophie (aged 0), Ben, Context3 and Context4. Hi Sophie (aged 0), Ben, Alex and Context4. Hi Sophie (aged 0), Ben, Alex and Sarah.` - ); - - this.rerender({ - person1: 'Context1', - person2: 'Context2', - person3: 'Context3', - person4: 'Context4', - age: 0, - }); - this.assertStableNodes(); - - this.assertHTML( - `Hi Context1. Hi Sophie (aged 0), Context2, Context3 and Context4. Hi Sophie (aged 0), Ben, Context3 and Context4. Hi Sophie (aged 0), Ben, Alex and Context4. Hi Sophie (aged 0), Ben, Alex and Sarah.` - ); - - this.rerender({ - person1: 'UpdatedContext1', - person2: 'UpdatedContext2', - person3: 'UpdatedContext3', - person4: 'UpdatedContext4', - age: 1, - }); - - this.assertHTML( - `Hi UpdatedContext1. Hi Sophie (aged 1), UpdatedContext2, UpdatedContext3 and UpdatedContext4. Hi Sophie (aged 1), Ben, UpdatedContext3 and UpdatedContext4. Hi Sophie (aged 1), Ben, Alex and UpdatedContext4. Hi Sophie (aged 1), Ben, Alex and Sarah.` - ); - - this.rerender({ - person1: 'Context1', - person2: 'Context2', - person3: 'Context3', - person4: 'Context4', - age: 0, - }); - - this.assertHTML( - `Hi Context1. Hi Sophie (aged 0), Context2, Context3 and Context4. Hi Sophie (aged 0), Ben, Context3 and Context4. Hi Sophie (aged 0), Ben, Alex and Context4. Hi Sophie (aged 0), Ben, Alex and Sarah.` - ); - } - - @test - 'dynamic partial with falsy value does not render'() { - this.render(`Before {{partial this.name}} After`, { name: false }); - - this.assertHTML(`Before After`); - this.rerender({ name: false }); - this.assertStableNodes(); - this.assertHTML(`Before After`); - } - - @test - 'static partial that does not exist asserts'() { - assert.throws(() => { - this.render(`Before {{partial 'test'}} After`); - }, /Could not find a partial named "test"/); - } - - @test - 'dynamic partial that does not exist does not render'() { - assert.throws(() => { - this.render(`Before {{partial this.name}} After`, { name: 'illuminati' }); - }, /Could not find a partial named "illuminati"/); - } - - @test - 'dynamic partial with can change from falsy to real template'() { - this.registerPartial('test', `
Testing
`); - - this.render(`Before {{partial this.name}} After`, { name: false }); - - this.assertHTML(`Before After`); - this.rerender({ name: false }); - this.assertStableNodes(); - - this.rerender({ name: 'test' }); - this.assertHTML(`Before
Testing
After`); - - this.rerender({ name: false }); - this.assertHTML(`Before After`); - - this.rerender({ name: 'test' }); - this.assertHTML(`Before
Testing
After`); - - this.rerender({ name: null }); - this.assertHTML(`Before After`); - - this.rerender({ name: 'test' }); - this.assertHTML(`Before
Testing
After`); - - this.rerender({ name: undefined }); - this.assertHTML(`Before After`); - } - - @test - 'dynamic partial with self reference'() { - this.registerPartial('test', `I know {{item}}. I have the best {{item}}s.`); - this.render(`{{partial this.name}}`, { name: 'test', item: 'partial' }); - - this.assertHTML(`I know partial. I have the best partials.`); - this.rerender({ name: 'test', item: 'partial' }); - this.assertStableNodes(); - this.assertHTML(`I know partial. I have the best partials.`); - } - - @test - 'changing dynamic partial with self reference'() { - this.registerPartial('weezy', `Ain't my birthday but I got my {{item}} on the cake.`); - this.registerPartial( - 'birdman', - `Respeck my {{item}}. When my {{item}} come up put some respeck on it.` - ); - this.render(`{{partial this.name}}`, { name: 'weezy', item: 'name' }); - - this.assertHTML(`Ain't my birthday but I got my name on the cake.`); - this.rerender({ name: 'birdman', item: 'name' }); - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - this.rerender({ name: 'birdman', item: 'name' }); - this.assertStableNodes(); - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - } - - @test - 'changing dynamic partial and changing reference values'() { - this.registerPartial('weezy', `Ain't my birthday but I got my {{item}} on the cake.`); - this.registerPartial( - 'birdman', - `Respeck my {{item}}. When my {{item}} come up put some respeck on it.` - ); - this.render(`{{partial this.name}}`, { name: 'weezy', item: 'partial' }); - - this.assertHTML(`Ain't my birthday but I got my partial on the cake.`); - this.rerender({ name: 'birdman', item: 'name' }); - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - this.rerender({ name: 'birdman', item: 'name' }); - this.assertStableNodes(); - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - } - - @test - 'changing dynamic partial and changing references'() { - this.registerPartial('weezy', `Ain't my birthday but I got my {{item}} on the cake.`); - this.registerPartial( - 'birdman', - `Respeck my {{noun}}. When my {{noun}} come up put some respeck on it.` - ); - this.render(`{{partial this.name}}`, { name: 'weezy', item: 'partial' }); - - this.assertHTML(`Ain't my birthday but I got my partial on the cake.`); - this.rerender({ name: 'birdman', noun: 'name' }); - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - this.rerender({ name: 'birdman', noun: 'name' }); - this.assertStableNodes(); - this.assertHTML(`Respeck my name. When my name come up put some respeck on it.`); - } - - @test - 'dynamic partial with local reference'() { - this.registerPartial('test', `You {{quality.value}}`); - this.render(`{{#each this.qualities key='id' as |quality|}}{{partial this.name}}. {{/each}}`, { - name: 'test', - qualities: [ - { id: 1, value: 'smaht' }, - { id: 2, value: 'loyal' }, - ], - }); - - this.assertStableRerender(); - - this.assertHTML(`You smaht. You loyal. `); - this.rerender({ - name: 'test', - qualities: [ - { id: 1, value: 'smaht' }, - { id: 2, value: 'loyal' }, - ], - }); - this.assertStableNodes(); - this.assertHTML(`You smaht. You loyal. `); - } - - @test - 'dynamic partial with local reference (unknown)'() { - this.registerPartial('test', `You {{quality}}`); - this.render( - `{{#each this.qualities key='@index' as |quality|}}{{partial this.name}}. {{/each}}`, - { - name: 'test', - qualities: ['smaht', 'loyal'], - } - ); - - this.assertStableRerender(); - - this.assertHTML(`You smaht. You loyal. `); - this.rerender({ name: 'test', qualities: ['smaht', 'loyal'] }); - this.assertStableNodes(); - this.assertHTML(`You smaht. You loyal. `); - } - - @test - 'partial with if statement on a simple local reference works as expected'() { - this.registerPartial('test', `{{#if quality}}You {{quality}}{{else}}No quality{{/if}}`); - this.render( - `{{#each this.qualities key='@index' as |quality|}}{{partial this.name}}. {{/each}}`, - { - name: 'test', - qualities: ['smaht', 'loyal', undefined], - } - ); - - this.assertStableRerender(); - - this.assertHTML(`You smaht. You loyal. No quality. `); - this.rerender({ name: 'test', qualities: ['smaht', 'loyal', undefined] }); - this.assertStableNodes(); - this.assertHTML(`You smaht. You loyal. No quality. `); - } - - @test - 'partial with if statement on a path local reference works as expected'() { - this.registerPartial( - 'test', - `{{#if quality.name}}You {{quality.name}}{{else}}No quality{{/if}}` - ); - this.render( - `{{#each this.qualities key='@index' as |quality|}}{{partial this.name}}. {{/each}}`, - { - name: 'test', - qualities: [{ name: 'smaht' }, { name: 'loyal' }, { name: undefined }], - } - ); - - this.assertStableRerender(); - - this.assertHTML(`You smaht. You loyal. No quality. `); - this.rerender({ - name: 'test', - qualities: [{ name: 'smaht' }, { name: 'loyal' }, { name: undefined }], - }); - this.assertStableNodes(); - this.assertHTML(`You smaht. You loyal. No quality. `); - } - - @test - 'partial without arguments throws'() { - assert.throws(() => { - this.render(`Before {{partial}} After`); - }, strip`Partial found with no arguments. You must specify a template name.`); - } - - @test - 'partial with more than one argument throws'() { - assert.throws(() => { - this.render(`Before {{partial 'turnt' 'up'}} After`); - }, strip`Partial found with 2 arguments. You can only specify a single template.`); - } -} - -jitSuite(PartialTest); diff --git a/packages/@glimmer/integration-tests/test/strict-mode-test.ts b/packages/@glimmer/integration-tests/test/strict-mode-test.ts index 0cc30e2cb5..2645c0735e 100644 --- a/packages/@glimmer/integration-tests/test/strict-mode-test.ts +++ b/packages/@glimmer/integration-tests/test/strict-mode-test.ts @@ -71,13 +71,6 @@ class GeneralStrictModeTest extends RenderTest { this.assertStableRerender(); } - @test - 'Cannot use partials in strict mode'() { - this.assert.throws(() => { - defineComponent({}, '{{partial bar}}'); - }, /{{partial}} is not allowed in strict mode templates/); - } - @test 'Implicit this lookup does not work'() { const Foo = defineComponent( diff --git a/packages/@glimmer/integration-tests/test/updating-test.ts b/packages/@glimmer/integration-tests/test/updating-test.ts index 3de288b050..395e9cc209 100644 --- a/packages/@glimmer/integration-tests/test/updating-test.ts +++ b/packages/@glimmer/integration-tests/test/updating-test.ts @@ -580,20 +580,6 @@ class UpdatingTest extends RenderTest { this.testStatefulHelper(assert, options); } - @test - 'helpers passed as arguments to {{partial}} are not torn down when switching between blocks'() { - this.registerPartial('yasss', 'Yes'); - this.registerPartial('noooo', ''); - - let options = { - template: '{{partial (stateful-foo)}}', - truthyValue: 'yasss', - falsyValue: 'noooo', - }; - - this.testStatefulHelper(assert, options); - } - @test 'helpers passed as arguments to {{component}} are not torn down when switching between blocks'() { this.registerComponent('Glimmer', 'XYasss', 'Yes'); diff --git a/packages/@glimmer/interfaces/lib/compile/wire-format.d.ts b/packages/@glimmer/interfaces/lib/compile/wire-format.d.ts index d7c1840d32..c4351d04fd 100644 --- a/packages/@glimmer/interfaces/lib/compile/wire-format.d.ts +++ b/packages/@glimmer/interfaces/lib/compile/wire-format.d.ts @@ -47,7 +47,6 @@ export const enum SexpOpcodes { AttrSplat = 17, Yield = 18, - Partial = 19, DynamicArg = 20, StaticArg = 21, @@ -346,7 +345,6 @@ export namespace Statements { export type AttrSplat = [SexpOpcodes.AttrSplat, YieldTo]; export type Yield = [SexpOpcodes.Yield, YieldTo, Option]; - export type Partial = [SexpOpcodes.Partial, Expression, Core.EvalInfo]; export type DynamicArg = [SexpOpcodes.DynamicArg, string, Expression]; export type StaticArg = [SexpOpcodes.StaticArg, string, Expression]; @@ -445,7 +443,6 @@ export namespace Statements { | Attribute | AttrSplat | Yield - | Partial | StaticArg | DynamicArg | Debugger diff --git a/packages/@glimmer/interfaces/lib/serialize.d.ts b/packages/@glimmer/interfaces/lib/serialize.d.ts index 669766aaf2..634f3761a7 100644 --- a/packages/@glimmer/interfaces/lib/serialize.d.ts +++ b/packages/@glimmer/interfaces/lib/serialize.d.ts @@ -23,7 +23,7 @@ * # CompileTimeLookup * * When compiling an application, the `CompileTimeLookup` is responsible - * for resolving helpers, modifiers, components, and partials into "handles" + * for resolving helpers, modifiers, and components into "handles" * (numbers) that can be embedded into the program and used at runtime. * * # RuntimeResolver @@ -31,9 +31,9 @@ * The `RuntimeResolver` has two responsibilities. * * 1. To turn handles created by the `CompileTimeLookup` into live helpers, - * modifiers, components, and partials. - * 2. To resolve dynamic components and partials at runtime that come from - * calls to `{{component dynamic}}` or `{{partial dynamic}}`. + * modifiers, and components. + * 2. To resolve dynamic components at runtime that come from + * calls to `{{component dynamic}}`. * * The `CompileTimeLookup` and `RuntimeResolver` must maintain symmetry * between: @@ -41,11 +41,6 @@ * * `resolver.resolve(lookup.lookupComponentDefinition(name, referrer))`; and * * `resolver.lookupComponentDefinition(name, referrer))` * - * And between: - * - * * `resolver.resolve(lookup.lookupPartial(name, referrer))`; and - * * `resolver.lookupPartial(name, referrer))` - * * # Coupling * * In practice, the `CompileTimeLookup` and `RuntimeResolver` are two parts @@ -89,7 +84,6 @@ export interface CompileTimeResolver { lookupHelper(name: string, owner: O): Option; lookupModifier(name: string, owner: O): Option; lookupComponent(name: string, owner: O): Option; - lookupPartial(name: string, owner: O): Option; // TODO: These are used to lookup keywords that are implemented as helpers/modifiers. // We should try to figure out a cleaner way to do this. @@ -97,15 +91,6 @@ export interface CompileTimeResolver { lookupBuiltInModifier(name: string): Option; } -export interface PartialDefinition { - name: string; // for debugging - - getPartial( - context: CompileTimeCompilationContext - ): { symbolTable: ProgramSymbolTable; handle: HandleResult }; -} - export interface RuntimeResolver { lookupComponent(name: string, owner: O): Option; - lookupPartial(name: string, owner: O): Option; } diff --git a/packages/@glimmer/interfaces/lib/vm-opcodes.d.ts b/packages/@glimmer/interfaces/lib/vm-opcodes.d.ts index 31e028aee9..c885cb1881 100644 --- a/packages/@glimmer/interfaces/lib/vm-opcodes.d.ts +++ b/packages/@glimmer/interfaces/lib/vm-opcodes.d.ts @@ -97,7 +97,6 @@ export const enum Op { CommitComponentTransaction = 98, DidCreateElement = 99, DidRenderLayout = 100, - InvokePartial = 101, ResolveMaybeLocal = 102, Debugger = 103, Size = 104, diff --git a/packages/@glimmer/opcode-compiler/index.ts b/packages/@glimmer/opcode-compiler/index.ts index fd74437fbc..e306b1ab98 100644 --- a/packages/@glimmer/opcode-compiler/index.ts +++ b/packages/@glimmer/opcode-compiler/index.ts @@ -16,8 +16,6 @@ export { meta } from './lib/opcode-builder/helpers/shared'; export { StdLib } from './lib/opcode-builder/stdlib'; -export { PartialDefinitionImpl } from './lib/partial-template'; - export { default as templateFactory, templateCacheCounters, diff --git a/packages/@glimmer/opcode-compiler/lib/opcode-builder/delegate.ts b/packages/@glimmer/opcode-compiler/lib/opcode-builder/delegate.ts index df5b4f21bf..a51d71acc1 100644 --- a/packages/@glimmer/opcode-compiler/lib/opcode-builder/delegate.ts +++ b/packages/@glimmer/opcode-compiler/lib/opcode-builder/delegate.ts @@ -36,7 +36,6 @@ export interface ResolverDelegate { lookupHelper?(name: string, referrer: R): Option | void; lookupModifier?(name: string, referrer: R): Option | void; lookupComponent?(name: string, referrer: R): Option | void; - lookupPartial?(name: string, referrer: R): Option | void; // For debugging resolve?(handle: number): R; diff --git a/packages/@glimmer/opcode-compiler/lib/partial-template.ts b/packages/@glimmer/opcode-compiler/lib/partial-template.ts deleted file mode 100644 index 77baa3f218..0000000000 --- a/packages/@glimmer/opcode-compiler/lib/partial-template.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { - ProgramSymbolTable, - Template, - CompileTimeCompilationContext, - HandleResult, - PartialDefinition, -} from '@glimmer/interfaces'; -import { unwrapTemplate } from '@glimmer/util'; - -export class PartialDefinitionImpl implements PartialDefinition { - constructor( - public name: string, // for debugging - private template: Template - ) {} - - getPartial( - context: CompileTimeCompilationContext - ): { symbolTable: ProgramSymbolTable; handle: HandleResult } { - let partial = unwrapTemplate(this.template).asPartial(); - let handle = partial.compile(context); - - return { symbolTable: partial.symbolTable, handle }; - } -} diff --git a/packages/@glimmer/opcode-compiler/lib/syntax/statements.ts b/packages/@glimmer/opcode-compiler/lib/syntax/statements.ts index 87dd4747b5..b61597629f 100644 --- a/packages/@glimmer/opcode-compiler/lib/syntax/statements.ts +++ b/packages/@glimmer/opcode-compiler/lib/syntax/statements.ts @@ -130,24 +130,6 @@ STATEMENTS.add(SexpOpcodes.Component, (op, [, expr, elementBlock, named, blocks] } }); -STATEMENTS.add(SexpOpcodes.Partial, (op, [, name, evalInfo]) => { - ReplayableIf( - op, - () => { - expr(op, name); - op(Op.Dup, $sp, 0); - - return 2; - }, - - () => { - op(Op.InvokePartial, evalSymbolsOperand(), evalInfo); - op(Op.PopScope); - op(MachineOp.PopFrame); - } - ); -}); - STATEMENTS.add(SexpOpcodes.Yield, (op, [, to, params]) => YieldBlock(op, to, params)); STATEMENTS.add(SexpOpcodes.AttrSplat, (op, [, to]) => YieldBlock(op, to, null)); diff --git a/packages/@glimmer/runtime/lib/bootstrap.ts b/packages/@glimmer/runtime/lib/bootstrap.ts index 0f5d7c28b3..32b12fec47 100644 --- a/packages/@glimmer/runtime/lib/bootstrap.ts +++ b/packages/@glimmer/runtime/lib/bootstrap.ts @@ -4,6 +4,5 @@ import './compiled/opcodes/component'; import './compiled/opcodes/content'; import './compiled/opcodes/debugger'; import './compiled/opcodes/dom'; -import './compiled/opcodes/partial'; import './compiled/opcodes/vm'; import './compiled/opcodes/lists'; diff --git a/packages/@glimmer/runtime/lib/compiled/opcodes/partial.ts b/packages/@glimmer/runtime/lib/compiled/opcodes/partial.ts deleted file mode 100644 index 9a45050c3f..0000000000 --- a/packages/@glimmer/runtime/lib/compiled/opcodes/partial.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Reference, valueForRef } from '@glimmer/reference'; -import { APPEND_OPCODES } from '../../opcodes'; -import { assert, unwrapHandle, decodeHandle } from '@glimmer/util'; -import { check } from '@glimmer/debug'; -import { Op, Dict } from '@glimmer/interfaces'; -import { CheckReference } from './-debug-strip'; -import { CONSTANTS } from '../../symbols'; - -APPEND_OPCODES.add(Op.InvokePartial, (vm, { op1: _symbols, op2: _evalInfo }) => { - let { [CONSTANTS]: constants, stack } = vm; - - let name = valueForRef(check(stack.pop(), CheckReference)); - assert(typeof name === 'string', `Could not find a partial named "${String(name)}"`); - - let outerScope = vm.scope(); - let owner = outerScope.owner; - let outerSymbols = constants.getArray(_symbols); - let evalInfo = constants.getArray(decodeHandle(_evalInfo)); - let definition = vm.runtime.resolver.lookupPartial(name as string, owner); - - assert(definition !== null, `Could not find a partial named "${name}"`); - - let { symbolTable, handle: vmHandle } = definition.getPartial(vm.context); - - { - let partialSymbols = symbolTable.symbols; - let partialScope = vm.pushRootScope(partialSymbols.length, owner); - let evalScope = outerScope.getEvalScope(); - partialScope.bindEvalScope(evalScope); - partialScope.bindSelf(outerScope.getSelf()); - - let locals = Object.create(outerScope.getPartialMap()) as Dict; - - for (let i = 0; i < evalInfo.length; i++) { - let slot = evalInfo[i]; - - if (slot !== -1) { - let name = outerSymbols[slot - 1]; - let ref = outerScope.getSymbol(slot); - locals[name] = ref; - } - } - - if (evalScope) { - for (let i = 0; i < partialSymbols.length; i++) { - let name = partialSymbols[i]; - let symbol = i + 1; - let value = evalScope[name]; - - if (value !== undefined) partialScope.bind(symbol, value); - } - } - - partialScope.bindPartialMap(locals); - - vm.pushFrame(); // sp += 2 - vm.call(unwrapHandle(vmHandle!)); - } -}); diff --git a/packages/@glimmer/vm/lib/opcodes.toml b/packages/@glimmer/vm/lib/opcodes.toml index 4b3cb63641..850ab98c0f 100644 --- a/packages/@glimmer/vm/lib/opcodes.toml +++ b/packages/@glimmer/vm/lib/opcodes.toml @@ -885,15 +885,6 @@ operation = "Invoke didCreateElement on the current component manager" format = ["DidRenderLayout", "state:register"] operation = "Invoke didRenderLayout on the current component manager" -[syscall.invokepartial] - -format = ["InvokePartial", "owner:owner", "symbols:str-array", "evalInfo:array"] -operation = "Lookup and invoke a partial template." -operand-stack = [ - ["Reference"], - ["$ra", "$fp"] -] - [syscall.eval_varload] format = ["ResolveMaybeLocal", "local:str"]