Skip to content

Commit

Permalink
Update to Glimmer VM 0.66.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Nov 17, 2020
1 parent 0f3266c commit 51c717f
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 147 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@
},
"devDependencies": {
"@babel/preset-env": "^7.9.5",
"@glimmer/compiler": "0.65.0",
"@glimmer/compiler": "0.66.0",
"@glimmer/env": "^0.1.7",
"@glimmer/global-context": "0.65.0",
"@glimmer/interfaces": "0.65.0",
"@glimmer/node": "0.65.0",
"@glimmer/opcode-compiler": "0.65.0",
"@glimmer/program": "0.65.0",
"@glimmer/reference": "0.65.0",
"@glimmer/runtime": "0.65.0",
"@glimmer/validator": "0.65.0",
"@glimmer/global-context": "0.66.0",
"@glimmer/interfaces": "0.66.0",
"@glimmer/node": "0.66.0",
"@glimmer/opcode-compiler": "0.66.0",
"@glimmer/program": "0.66.0",
"@glimmer/reference": "0.66.0",
"@glimmer/runtime": "0.66.0",
"@glimmer/validator": "0.66.0",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.9.1",
"@types/rsvp": "^4.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default class CurlyComponentManager
return null;
}

return { positional: EMPTY_ARRAY, named };
return { positional: EMPTY_ARRAY as readonly Reference[], named };
}

/*
Expand Down
8 changes: 4 additions & 4 deletions packages/@ember/-internals/glimmer/lib/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ class ClassicHelperManager implements HelperManager<ClassicHelperStateBucket> {

if (DEBUG) {
deprecateMutationsInTrackingTransaction!(() => {
ret = instance.compute(positional, named);
ret = instance.compute(positional as unknown[], named);
});
} else {
ret = instance.compute(positional, named);
ret = instance.compute(positional as unknown[], named);
}

consumeTag(instance[RECOMPUTE_TAG]);
Expand Down Expand Up @@ -227,14 +227,14 @@ class SimpleClassicHelperManager implements HelperManager<() => unknown> {
let ret;

deprecateMutationsInTrackingTransaction!(() => {
ret = compute.call(null, args.positional, args.named);
ret = compute.call(null, args.positional as unknown[], args.named);
});

return ret;
};
}

return () => compute.call(null, args.positional, args.named);
return () => compute.call(null, args.positional as unknown[], args.named);
}

getValue(fn: () => unknown) {
Expand Down
6 changes: 1 addition & 5 deletions packages/@ember/-internals/glimmer/lib/syntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ function refineInlineSyntax(
let component = context.resolver.lookupComponent(name, context.meta.owner!);

if (component !== null) {
return staticComponent(component, [
params === null ? [] : params,
hashToArgs(hash),
EMPTY_BLOCKS,
]);
return staticComponent(component, [params, hashToArgs(hash), EMPTY_BLOCKS]);
}

return UNHANDLED;
Expand Down
4 changes: 2 additions & 2 deletions packages/@ember/-internals/glimmer/lib/syntax/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Core, Option } from '@glimmer/interfaces';
import { Core, Option, PresentArray } from '@glimmer/interfaces';

export function hashToArgs(hash: Option<Core.Hash>): Option<Core.Hash> {
if (hash === null) return null;
let names = hash[0].map((key) => `@${key}`);
return [names, hash[1]];
return [names as PresentArray<string>, hash[1]];
}
Original file line number Diff line number Diff line change
Expand Up @@ -613,20 +613,12 @@ moduleFor(
}

'@test can not invoke curried components with an implicit `this` path'(assert) {
assert.expect(0);
this.registerComponent('foo-bar', {
template: 'hello',
ComponentClass: Component.extend({
init() {
this._super(...arguments);
assert.ok(false, 'should not have instantiated');
},
}),
});
this.registerComponent('test-harness', {
template: '<foo.bar />',
});
this.render(strip`{{test-harness foo=(hash bar=(component 'foo-bar'))}}`);
assert.throws(() => {
// attempting to compile this template will throw
this.registerComponent('test-harness', {
template: '<foo.bar />',
});
}, /Error: You used foo.bar as a tag name, but foo is not in scope/);
}

'@test has-block'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,24 @@ moduleFor(
}, `'@Foo' is reserved. ('baz/foo-bar' @ L1:C17) `);
}

[`@test '@.' is reserved`]() {
expectAssertion(() => {
[`@test '@.' is reserved`](assert) {
assert.throws(() => {
compile(`{{@.}}`, {
moduleName: 'baz/foo-bar',
});
}, `'@.' is reserved. ('baz/foo-bar' @ L1:C2) `);
}, /Attempted to parse a path expression, but it was not valid. Paths beginning with @ must start with a-z/);

expectAssertion(() => {
assert.throws(() => {
compile(`{{#if @.}}Yup{{/if}}`, {
moduleName: 'baz/foo-bar',
});
}, `'@.' is reserved. ('baz/foo-bar' @ L1:C6) `);
}, /Attempted to parse a path expression, but it was not valid. Paths beginning with @ must start with a-z/);

expectAssertion(() => {
assert.throws(() => {
compile(`{{input type=(if @. "bar" "baz")}}`, {
moduleName: 'baz/foo-bar',
});
}, `'@.' is reserved. ('baz/foo-bar' @ L1:C17) `);
}, /Attempted to parse a path expression, but it was not valid. Paths beginning with @ must start with a-z/);
}

[`@test '@_' is reserved`]() {
Expand Down
Loading

0 comments on commit 51c717f

Please sign in to comment.