Skip to content

Commit cafe427

Browse files
committed
Handle symbol literals
(Hitting this in angular / stack_trace.) [email protected] Review URL: https://codereview.chromium.org/1060813008
1 parent af58426 commit cafe427

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/dev_compiler/lib/runtime/dart/_js_helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ var _js_helper;
20402040
});
20412041
}
20422042
let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argumentCount}${names}`;
2043-
return dart.dsend(func, 'noSuchMethod', createUnmangledInvocationMirror(dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMirror.METHOD, arguments$, namedArgumentList));
2043+
return dart.dsend(func, 'noSuchMethod', createUnmangledInvocationMirror(/* Unimplemented const */new _internal.Symbol("call"), selectorName, JSInvocationMirror.METHOD, arguments$, namedArgumentList));
20442044
}
20452045
static applyFunction(func, positionalArguments, namedArguments) {
20462046
return namedArguments == null ? Primitives.applyFunctionWithPositionalArguments(func, positionalArguments) : Primitives.applyFunctionWithNamedArguments(func, positionalArguments, namedArguments);

pkg/dev_compiler/lib/src/codegen/js_codegen.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,16 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
20522052
@override
20532053
visitNullLiteral(NullLiteral node) => new JS.LiteralNull();
20542054

2055+
@override
2056+
visitSymbolLiteral(SymbolLiteral node) {
2057+
// TODO(vsm): When we canonicalize, we need to treat private symbols
2058+
// correctly.
2059+
// TODO(vsm): Make this core.Symbol instead.
2060+
var name = js.escapedString(node.components.join('.'));
2061+
var symbol = js.call('new _internal.Symbol(#)', name);
2062+
return js.commentExpression('Unimplemented const', symbol);
2063+
}
2064+
20552065
@override
20562066
visitListLiteral(ListLiteral node) {
20572067
JS.Expression list = new JS.ArrayInitializer(_visitList(node.elements));

0 commit comments

Comments
 (0)