Chromium Code Reviews| Index: lib/compiler/implementation/ssa/builder.dart |
| diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart |
| index fe9cc7da6c39b187cfad1942fe8c654b4680acb5..48184abe255222fc0e86917158a4e08440db244b 100644 |
| --- a/lib/compiler/implementation/ssa/builder.dart |
| +++ b/lib/compiler/implementation/ssa/builder.dart |
| @@ -1871,6 +1871,15 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| push(result); |
| } |
| + void pushInvokeHelper3(Element helper, HInstruction a0, HInstruction a1, |
| + HInstruction a2) { |
| + HInstruction reference = new HStatic(helper); |
| + add(reference); |
| + List<HInstruction> inputs = <HInstruction>[reference, a0, a1, a2]; |
| + HInstruction result = new HInvokeStatic(inputs); |
| + push(result); |
| + } |
| + |
| visitOperatorSend(node) { |
| assert(node.selector is Operator); |
| if (!methodInterceptionEnabled) { |
| @@ -2421,7 +2430,29 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| // TODO(karlklose): generate runtime error or noSuchMethodCall, depending |
|
ngeoffray
2012/08/23 10:25:05
Remove TODO.
karlklose
2012/08/23 11:05:56
Done.
|
| // on whether element is null or it is an erroneous element with a |
| // particular error message. |
| - compiler.cancel('Unimplemented unresolved constructor call', node: node); |
| + ErroneousElement error = element; |
| + Message message = error.errorMessage; |
| + if (message.kind === MessageKind.CANNOT_FIND_CONSTRUCTOR) { |
| + Element helper = |
| + compiler.findHelper(const SourceString('throwNoSuchMethod')); |
| + DartString receiverLiteral = new DartString.literal(''); |
| + HInstruction receiver = graph.addConstantString(receiverLiteral, node); |
| + String constructorName = 'constructor ${message.arguments[0]}'; |
| + DartString nameLiteral = new DartString.literal(constructorName); |
| + HInstruction name = graph.addConstantString(nameLiteral, node.send); |
| + List<HInstruction> inputs = <HInstruction>[]; |
| + node.send.arguments.forEach((argumentNode) { |
| + visit(argumentNode); |
| + HInstruction value = pop(); |
| + inputs.add(value); |
| + }); |
| + HInstruction arguments = new HLiteralList(inputs); |
| + add(arguments); |
| + pushInvokeHelper3(helper, receiver, name, arguments); |
| + } else { |
| + compiler.cancel('Unimplemented unresolved constructor call', |
|
ngeoffray
2012/08/23 10:25:05
Maybe use the message local variable instead to gi
karlklose
2012/08/23 11:05:56
This branch is currently unreachable. I will imple
|
| + node: node); |
| + } |
| } else if (node.isConst()) { |
| // TODO(karlklose): add type representation |
| ConstantHandler handler = compiler.constantHandler; |