OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class Interceptors { | 5 class Interceptors { |
6 Compiler compiler; | 6 Compiler compiler; |
7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
8 | 8 |
9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2391 inputs.add(closureTarget); | 2391 inputs.add(closureTarget); |
2392 addDynamicSendArgumentsToList(node, inputs); | 2392 addDynamicSendArgumentsToList(node, inputs); |
2393 pushWithPosition(new HInvokeClosure(selector, inputs), node); | 2393 pushWithPosition(new HInvokeClosure(selector, inputs), node); |
2394 } | 2394 } |
2395 | 2395 |
2396 void handleForeignJs(Send node) { | 2396 void handleForeignJs(Send node) { |
2397 Link<Node> link = node.arguments; | 2397 Link<Node> link = node.arguments; |
2398 // If the invoke is on foreign code, don't visit the first | 2398 // If the invoke is on foreign code, don't visit the first |
2399 // argument, which is the type, and the second argument, | 2399 // argument, which is the type, and the second argument, |
2400 // which is the foreign code. | 2400 // which is the foreign code. |
2401 if (link.isEmpty() || link.isEmpty()) { | 2401 if (link.isEmpty() || link.isEmpty()) { |
Lasse Reichstein Nielsen
2012/09/17 11:58:06
This seems wrong!
| |
2402 compiler.cancel('At least two arguments expected', | 2402 compiler.cancel('At least two arguments expected', |
2403 node: node.argumentsNode); | 2403 node: node.argumentsNode); |
2404 } | 2404 } |
2405 link = link.tail.tail; | 2405 link = link.tail.tail; |
2406 List<HInstruction> inputs = <HInstruction>[]; | 2406 List<HInstruction> inputs = <HInstruction>[]; |
2407 addGenericSendArgumentsToList(link, inputs); | 2407 addGenericSendArgumentsToList(link, inputs); |
2408 Node type = node.arguments.head; | 2408 Node type = node.arguments.head; |
2409 Node literal = node.arguments.tail.head; | 2409 Node literal = node.arguments.tail.head; |
2410 if (literal is !StringNode || literal.dynamic.isInterpolation) { | 2410 if (literal is !StringNode || (literal as Dynamic).isInterpolation) { |
kasperl
2012/09/14 07:56:33
I understand that you may not want to fix this now
Lasse Reichstein Nielsen
2012/09/17 11:58:06
Still, it sucks. I'll change this.
| |
2411 compiler.cancel('JS code must be a string literal', node: literal); | 2411 compiler.cancel('JS code must be a string literal', node: literal); |
2412 } | 2412 } |
2413 if (type is !LiteralString) { | 2413 if (type is !LiteralString) { |
2414 compiler.cancel( | 2414 compiler.cancel( |
2415 'The type of a JS expression must be a string literal', node: type); | 2415 'The type of a JS expression must be a string literal', node: type); |
2416 } | 2416 } |
2417 push(new HForeign( | 2417 push(new HForeign( |
2418 literal.dynamic.dartString, type.dynamic.dartString, inputs)); | 2418 (literal as Dynamic).dartString, (type as Dynamic).dartString, inputs)); |
2419 } | 2419 } |
2420 | 2420 |
2421 void handleForeignUnintercepted(Send node) { | 2421 void handleForeignUnintercepted(Send node) { |
2422 Link<Node> link = node.arguments; | 2422 Link<Node> link = node.arguments; |
2423 if (!link.tail.isEmpty()) { | 2423 if (!link.tail.isEmpty()) { |
2424 compiler.cancel( | 2424 compiler.cancel( |
2425 'More than one expression in UNINTERCEPTED()', node: node); | 2425 'More than one expression in UNINTERCEPTED()', node: node); |
2426 } | 2426 } |
2427 Expression expression = link.head; | 2427 Expression expression = link.head; |
2428 disableMethodInterception(); | 2428 disableMethodInterception(); |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4188 new HSubGraphBlockInformation(elseBranch.graph)); | 4188 new HSubGraphBlockInformation(elseBranch.graph)); |
4189 | 4189 |
4190 HBasicBlock conditionStartBlock = conditionBranch.block; | 4190 HBasicBlock conditionStartBlock = conditionBranch.block; |
4191 conditionStartBlock.setBlockFlow(info, joinBlock); | 4191 conditionStartBlock.setBlockFlow(info, joinBlock); |
4192 SubGraph conditionGraph = conditionBranch.graph; | 4192 SubGraph conditionGraph = conditionBranch.graph; |
4193 HIf branch = conditionGraph.end.last; | 4193 HIf branch = conditionGraph.end.last; |
4194 assert(branch is HIf); | 4194 assert(branch is HIf); |
4195 branch.blockInformation = conditionStartBlock.blockFlow; | 4195 branch.blockInformation = conditionStartBlock.blockFlow; |
4196 } | 4196 } |
4197 } | 4197 } |
OLD | NEW |