| 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 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 } else if (const SourceString("&&") == op.source || | 1218 } else if (const SourceString("&&") == op.source || |
| 1219 const SourceString("||") == op.source) { | 1219 const SourceString("||") == op.source) { |
| 1220 visitLogicalAndOr(node, op); | 1220 visitLogicalAndOr(node, op); |
| 1221 } else if (const SourceString("!") == op.source) { | 1221 } else if (const SourceString("!") == op.source) { |
| 1222 visitLogicalNot(node); | 1222 visitLogicalNot(node); |
| 1223 } else if (node.argumentsNode is Prefix) { | 1223 } else if (node.argumentsNode is Prefix) { |
| 1224 visitUnary(node, op); | 1224 visitUnary(node, op); |
| 1225 } else if (const SourceString("is") == op.source) { | 1225 } else if (const SourceString("is") == op.source) { |
| 1226 visit(node.receiver); | 1226 visit(node.receiver); |
| 1227 HInstruction expression = pop(); | 1227 HInstruction expression = pop(); |
| 1228 push(new HIs(elements[node.arguments.head], expression)); | 1228 Node argument = node.arguments.head; |
| 1229 TypeAnnotation type = argument.asTypeAnnotation(); |
| 1230 bool isNot = false; |
| 1231 // TODO(ngeoffray): Duplicating pattern in resolver. We should |
| 1232 // add a new kind of node. |
| 1233 if (type == null) { |
| 1234 type = argument.asSend().receiver; |
| 1235 isNot = true; |
| 1236 } |
| 1237 HInstruction instruction = new HIs(elements[type], expression); |
| 1238 if (isNot) { |
| 1239 add(instruction); |
| 1240 instruction = new HNot(instruction); |
| 1241 } |
| 1242 push(instruction); |
| 1229 } else { | 1243 } else { |
| 1230 visit(node.receiver); | 1244 visit(node.receiver); |
| 1231 visit(node.argumentsNode); | 1245 visit(node.argumentsNode); |
| 1232 var right = pop(); | 1246 var right = pop(); |
| 1233 var left = pop(); | 1247 var left = pop(); |
| 1234 visitBinary(left, op, right); | 1248 visitBinary(left, op, right); |
| 1235 } | 1249 } |
| 1236 } | 1250 } |
| 1237 | 1251 |
| 1238 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) { | 1252 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) { |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 } | 1967 } |
| 1954 | 1968 |
| 1955 visitCatchBlock(CatchBlock node) { | 1969 visitCatchBlock(CatchBlock node) { |
| 1956 visit(node.block); | 1970 visit(node.block); |
| 1957 } | 1971 } |
| 1958 | 1972 |
| 1959 visitTypedef(Typedef node) { | 1973 visitTypedef(Typedef node) { |
| 1960 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1974 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1961 } | 1975 } |
| 1962 } | 1976 } |
| OLD | NEW |