| 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 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 Node argument = node.arguments.head; | 1771 Node argument = node.arguments.head; |
| 1772 TypeAnnotation typeAnnotation = argument.asTypeAnnotation(); | 1772 TypeAnnotation typeAnnotation = argument.asTypeAnnotation(); |
| 1773 bool isNot = false; | 1773 bool isNot = false; |
| 1774 // TODO(ngeoffray): Duplicating pattern in resolver. We should | 1774 // TODO(ngeoffray): Duplicating pattern in resolver. We should |
| 1775 // add a new kind of node. | 1775 // add a new kind of node. |
| 1776 if (typeAnnotation == null) { | 1776 if (typeAnnotation == null) { |
| 1777 typeAnnotation = argument.asSend().receiver; | 1777 typeAnnotation = argument.asSend().receiver; |
| 1778 isNot = true; | 1778 isNot = true; |
| 1779 } | 1779 } |
| 1780 Type type = elements.getType(typeAnnotation); | 1780 Type type = elements.getType(typeAnnotation); |
| 1781 HInstruction instruction = new HIs(type, expression); | 1781 if (type.element.kind === ElementKind.TYPE_VARIABLE) { |
| 1782 if (isNot) { | 1782 // TODO(karlklose): We emulate the frog behavior and answer |
| 1783 add(instruction); | 1783 // true to any is check involving a type variable -- both is T |
| 1784 instruction = new HNot(instruction); | 1784 // and is !T -- until we have a proper implementation of |
| 1785 // reified generics. |
| 1786 stack.add(graph.addConstantBool(true)); |
| 1787 } else { |
| 1788 HInstruction instruction = new HIs(type, expression); |
| 1789 if (isNot) { |
| 1790 add(instruction); |
| 1791 instruction = new HNot(instruction); |
| 1792 } |
| 1793 push(instruction); |
| 1785 } | 1794 } |
| 1786 push(instruction); | |
| 1787 } else { | 1795 } else { |
| 1788 visit(node.receiver); | 1796 visit(node.receiver); |
| 1789 visit(node.argumentsNode); | 1797 visit(node.argumentsNode); |
| 1790 var right = pop(); | 1798 var right = pop(); |
| 1791 var left = pop(); | 1799 var left = pop(); |
| 1792 visitBinary(left, op, right); | 1800 visitBinary(left, op, right); |
| 1793 } | 1801 } |
| 1794 } | 1802 } |
| 1795 | 1803 |
| 1796 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) { | 1804 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) { |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3112 false, | 3120 false, |
| 3113 <HInstruction>[target, input])); | 3121 <HInstruction>[target, input])); |
| 3114 return builder.pop(); | 3122 return builder.pop(); |
| 3115 } | 3123 } |
| 3116 | 3124 |
| 3117 HInstruction result() { | 3125 HInstruction result() { |
| 3118 flushLiterals(); | 3126 flushLiterals(); |
| 3119 return prefix; | 3127 return prefix; |
| 3120 } | 3128 } |
| 3121 } | 3129 } |
| OLD | NEW |