OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Generate code using the cps-based IR pipeline. | 5 /// Generate code using the cps-based IR pipeline. |
6 library code_generator_task; | 6 library code_generator_task; |
7 | 7 |
8 import 'glue.dart'; | 8 import 'glue.dart'; |
9 import 'codegen.dart'; | 9 import 'codegen.dart'; |
10 import 'unsugar.dart'; | 10 import 'unsugar.dart'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); | 112 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); |
113 if (cpsNode == null) { | 113 if (cpsNode == null) { |
114 if (irBuilderTask.bailoutMessage == null) { | 114 if (irBuilderTask.bailoutMessage == null) { |
115 giveUp('unable to build cps definition of $element'); | 115 giveUp('unable to build cps definition of $element'); |
116 } else { | 116 } else { |
117 giveUp(irBuilderTask.bailoutMessage); | 117 giveUp(irBuilderTask.bailoutMessage); |
118 } | 118 } |
119 } | 119 } |
120 if (element.isInstanceMember && !element.isGenerativeConstructorBody) { | |
121 Selector selector = new Selector.fromElement(cpsNode.element); | |
122 if (glue.isInterceptedSelector(selector)) { | |
123 giveUp('cannot compile methods that need interceptor calling ' | |
124 'convention.'); | |
125 } | |
126 } | |
127 traceGraph("IR Builder", cpsNode); | 120 traceGraph("IR Builder", cpsNode); |
128 new UnsugarVisitor(glue).rewrite(cpsNode); | 121 new UnsugarVisitor(glue).rewrite(cpsNode); |
129 traceGraph("Unsugaring", cpsNode); | 122 traceGraph("Unsugaring", cpsNode); |
130 return cpsNode; | 123 return cpsNode; |
131 } | 124 } |
132 | 125 |
133 static const Pattern PRINT_TYPED_IR_FILTER = null; | 126 static const Pattern PRINT_TYPED_IR_FILTER = null; |
134 | 127 |
135 String formatTypeMask(TypeMask type) { | 128 String formatTypeMask(TypeMask type) { |
136 if (type is UnionTypeMask) { | 129 if (type is UnionTypeMask) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // TODO(sigurdm): Make a better list of tasks. | 223 // TODO(sigurdm): Make a better list of tasks. |
231 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 224 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
232 } | 225 } |
233 | 226 |
234 js.Node attachPosition(js.Node node, AstElement element) { | 227 js.Node attachPosition(js.Node node, AstElement element) { |
235 return node.withSourceInformation( | 228 return node.withSourceInformation( |
236 sourceInformationFactory.forContext(element) | 229 sourceInformationFactory.forContext(element) |
237 .buildDeclaration(element)); | 230 .buildDeclaration(element)); |
238 } | 231 } |
239 } | 232 } |
OLD | NEW |