Chromium Code Reviews| 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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1213 } else if (const SourceString("&&") == op.source || | 1213 } else if (const SourceString("&&") == op.source || |
| 1214 const SourceString("||") == op.source) { | 1214 const SourceString("||") == op.source) { |
| 1215 visitLogicalAndOr(node, op); | 1215 visitLogicalAndOr(node, op); |
| 1216 } else if (const SourceString("!") == op.source) { | 1216 } else if (const SourceString("!") == op.source) { |
| 1217 visitLogicalNot(node); | 1217 visitLogicalNot(node); |
| 1218 } else if (node.argumentsNode is Prefix) { | 1218 } else if (node.argumentsNode is Prefix) { |
| 1219 visitUnary(node, op); | 1219 visitUnary(node, op); |
| 1220 } else if (const SourceString("is") == op.source) { | 1220 } else if (const SourceString("is") == op.source) { |
| 1221 visit(node.receiver); | 1221 visit(node.receiver); |
| 1222 HInstruction expression = pop(); | 1222 HInstruction expression = pop(); |
| 1223 push(new HIs(elements[node.arguments.head], expression)); | 1223 Node argument = node.arguments.head; |
| 1224 TypeAnnotation type = argument.asTypeAnnotation(); | |
| 1225 bool isNot = false; | |
| 1226 if (type == null) { | |
| 1227 type = argument.asSend().receiver; | |
|
ahe
2012/02/13 09:59:57
You're repeating the pattern from the resolver her
| |
| 1228 isNot = true; | |
| 1229 } | |
| 1230 HInstruction instruction = new HIs(elements[type], expression); | |
| 1231 if (isNot) { | |
| 1232 add(instruction); | |
| 1233 instruction = new HNot(instruction); | |
| 1234 } | |
| 1235 push(instruction); | |
| 1224 } else { | 1236 } else { |
| 1225 visit(node.receiver); | 1237 visit(node.receiver); |
| 1226 visit(node.argumentsNode); | 1238 visit(node.argumentsNode); |
| 1227 var right = pop(); | 1239 var right = pop(); |
| 1228 var left = pop(); | 1240 var left = pop(); |
| 1229 visitBinary(left, op, right); | 1241 visitBinary(left, op, right); |
| 1230 } | 1242 } |
| 1231 } | 1243 } |
| 1232 | 1244 |
| 1233 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) { | 1245 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) { |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1943 } | 1955 } |
| 1944 | 1956 |
| 1945 visitCatchBlock(CatchBlock node) { | 1957 visitCatchBlock(CatchBlock node) { |
| 1946 visit(node.block); | 1958 visit(node.block); |
| 1947 } | 1959 } |
| 1948 | 1960 |
| 1949 visitTypedef(Typedef node) { | 1961 visitTypedef(Typedef node) { |
| 1950 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1962 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1951 } | 1963 } |
| 1952 } | 1964 } |
| OLD | NEW |