| Index: lib/compiler/implementation/ssa/builder.dart
|
| diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
|
| index f2fb383022adee59b8c2cbc3c464138a450a2c95..9baeb6c6ddfbdb3ce9db6e3800a32d700b716432 100644
|
| --- a/lib/compiler/implementation/ssa/builder.dart
|
| +++ b/lib/compiler/implementation/ssa/builder.dart
|
| @@ -2398,24 +2398,33 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| // If the invoke is on foreign code, don't visit the first
|
| // argument, which is the type, and the second argument,
|
| // which is the foreign code.
|
| - if (link.isEmpty() || link.isEmpty()) {
|
| + if (link.isEmpty() || link.tail.isEmpty()) {
|
| compiler.cancel('At least two arguments expected',
|
| node: node.argumentsNode);
|
| }
|
| - link = link.tail.tail;
|
| List<HInstruction> inputs = <HInstruction>[];
|
| - addGenericSendArgumentsToList(link, inputs);
|
| - Node type = node.arguments.head;
|
| - Node literal = node.arguments.tail.head;
|
| - if (literal is !StringNode || literal.dynamic.isInterpolation) {
|
| - compiler.cancel('JS code must be a string literal', node: literal);
|
| - }
|
| + Node type = link.head;
|
| + Node code = link.tail.head;
|
| + addGenericSendArgumentsToList(link.tail.tail, inputs);
|
| +
|
| if (type is !LiteralString) {
|
| - compiler.cancel(
|
| - 'The type of a JS expression must be a string literal', node: type);
|
| + // The type must not be a juxtaposition or interpolation.
|
| + compiler.cancel('The type of a JS expression must be a string literal',
|
| + node: type);
|
| + }
|
| + LiteralString typeString = type;
|
| +
|
| + if (code is StringNode) {
|
| + StringNode codeString = code;
|
| + if (!codeString.isInterpolation) {
|
| + // codeString may not be an interpolation, but may be a juxtaposition.
|
| + push(new HForeign(codeString.dartString,
|
| + typeString.dartString,
|
| + inputs));
|
| + return;
|
| + }
|
| }
|
| - push(new HForeign(
|
| - literal.dynamic.dartString, type.dynamic.dartString, inputs));
|
| + compiler.cancel('JS code must be a string literal', node: literal);
|
| }
|
|
|
| void handleForeignUnintercepted(Send node) {
|
|
|