| OLD | NEW |
| 1 library dart2js.unsugar_cps; | 1 library dart2js.unsugar_cps; |
| 2 | 2 |
| 3 import '../../cps_ir/cps_ir_nodes.dart'; | 3 import '../../cps_ir/cps_ir_nodes.dart'; |
| 4 | 4 |
| 5 // TODO(karlklose): share the [ParentVisitor]. | 5 // TODO(karlklose): share the [ParentVisitor]. |
| 6 import '../../cps_ir/optimizers.dart'; | 6 import '../../cps_ir/optimizers.dart'; |
| 7 import '../../constants/expressions.dart'; | 7 import '../../constants/expressions.dart'; |
| 8 import '../../constants/values.dart'; | 8 import '../../constants/values.dart'; |
| 9 import '../../elements/elements.dart' | 9 import '../../elements/elements.dart' |
| 10 show ClassElement, FieldElement, FunctionElement, Element; | 10 show ClassElement, FieldElement, FunctionElement, Element; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 stackTraceValue.substituteFor(stackTraceParameter); | 99 stackTraceValue.substituteFor(stackTraceParameter); |
| 100 insertStaticCall(_glue.getTraceFromException(), [exceptionValue], | 100 insertStaticCall(_glue.getTraceFromException(), [exceptionValue], |
| 101 stackTraceValue, body); | 101 stackTraceValue, body); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 assert(stackTraceParameter.hasNoUses); | 105 assert(stackTraceParameter.hasNoUses); |
| 106 node.handler.parameters.removeLast(); | 106 node.handler.parameters.removeLast(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 processThrow(Throw node) { |
| 110 // The subexpression of throw is wrapped in the JavaScript output. |
| 111 Parameter value = new Parameter(null); |
| 112 insertStaticCall(_glue.getWrapExceptionHelper(), [node.value.definition], |
| 113 value, node); |
| 114 node.value = new Reference<Primitive>(value); |
| 115 } |
| 116 |
| 109 processInvokeMethod(InvokeMethod node) { | 117 processInvokeMethod(InvokeMethod node) { |
| 110 Selector selector = node.selector; | 118 Selector selector = node.selector; |
| 111 // TODO(karlklose): should we rewrite all selectors? | 119 // TODO(karlklose): should we rewrite all selectors? |
| 112 if (!_glue.isInterceptedSelector(selector)) return; | 120 if (!_glue.isInterceptedSelector(selector)) return; |
| 113 | 121 |
| 114 Primitive receiver = node.receiver.definition; | 122 Primitive receiver = node.receiver.definition; |
| 115 Set<ClassElement> interceptedClasses = | 123 Set<ClassElement> interceptedClasses = |
| 116 _glue.getInterceptedClassesOn(selector); | 124 _glue.getInterceptedClassesOn(selector); |
| 117 _glue.registerSpecializedGetInterceptor(interceptedClasses); | 125 _glue.registerSpecializedGetInterceptor(interceptedClasses); |
| 118 | 126 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 148 new LetPrim(i, | 156 new LetPrim(i, |
| 149 new Branch(new IsTrue(i), | 157 new Branch(new IsTrue(i), |
| 150 node.trueContinuation.definition, | 158 node.trueContinuation.definition, |
| 151 node.falseContinuation.definition))); | 159 node.falseContinuation.definition))); |
| 152 condition.value.unlink(); | 160 condition.value.unlink(); |
| 153 node.trueContinuation.unlink(); | 161 node.trueContinuation.unlink(); |
| 154 node.falseContinuation.unlink(); | 162 node.falseContinuation.unlink(); |
| 155 parent.body = newNode; | 163 parent.body = newNode; |
| 156 } | 164 } |
| 157 } | 165 } |
| OLD | NEW |