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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // TODO(sigurdm): Support these constructs. | 103 // TODO(sigurdm): Support these constructs. |
104 if (element.isNative || | 104 if (element.isNative || |
105 element.isField) { | 105 element.isField) { |
106 giveUp('unsupported element kind: ${element.name}:${element.kind}'); | 106 giveUp('unsupported element kind: ${element.name}:${element.kind}'); |
107 } | 107 } |
108 | 108 |
109 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); | 109 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); |
110 if (cpsNode == null) { | 110 if (cpsNode == null) { |
111 giveUp('unable to build cps definition of $element'); | 111 giveUp('unable to build cps definition of $element'); |
112 } | 112 } |
113 if (element.isInstanceMember && !element.isGenerativeConstructorBody) { | |
114 Selector selector = new Selector.fromElement(cpsNode.element); | |
115 if (glue.isInterceptedSelector(selector)) { | |
116 giveUp('cannot compile methods that need interceptor calling ' | |
117 'convention.'); | |
118 } | |
119 } | |
120 traceGraph("IR Builder", cpsNode); | 113 traceGraph("IR Builder", cpsNode); |
121 new UnsugarVisitor(glue).rewrite(cpsNode); | 114 new UnsugarVisitor(glue).rewrite(cpsNode); |
122 traceGraph("Unsugaring", cpsNode); | 115 traceGraph("Unsugaring", cpsNode); |
123 return cpsNode; | 116 return cpsNode; |
124 } | 117 } |
125 | 118 |
126 static const Pattern PRINT_TYPED_IR_FILTER = null; | 119 static const Pattern PRINT_TYPED_IR_FILTER = null; |
127 | 120 |
128 String formatTypeMask(TypeMask type) { | 121 String formatTypeMask(TypeMask type) { |
129 if (type is UnionTypeMask) { | 122 if (type is UnionTypeMask) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 Iterable<CompilerTask> get tasks { | 219 Iterable<CompilerTask> get tasks { |
227 // TODO(sigurdm): Make a better list of tasks. | 220 // TODO(sigurdm): Make a better list of tasks. |
228 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 221 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
229 } | 222 } |
230 | 223 |
231 js.Node attachPosition(js.Node node, AstElement element) { | 224 js.Node attachPosition(js.Node node, AstElement element) { |
232 return node.withSourceInformation( | 225 return node.withSourceInformation( |
233 StartEndSourceInformation.computeSourceInformation(element)); | 226 StartEndSourceInformation.computeSourceInformation(element)); |
234 } | 227 } |
235 } | 228 } |
OLD | NEW |