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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 void traceGraph(String title, var irObject) { | 99 void traceGraph(String title, var irObject) { |
100 if (tracer != null) { | 100 if (tracer != null) { |
101 tracer.traceGraph(title, irObject); | 101 tracer.traceGraph(title, irObject); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 cps.FunctionDefinition compileToCpsIR(AstElement element) { | 105 cps.FunctionDefinition compileToCpsIR(AstElement element) { |
106 // TODO(sigurdm): Support these constructs. | 106 // TODO(sigurdm): Support these constructs. |
107 if (element.isNative || | 107 if (element.isNative) { |
108 element.isField) { | |
109 giveUp('unsupported element kind: ${element.name}:${element.kind}'); | 108 giveUp('unsupported element kind: ${element.name}:${element.kind}'); |
110 } | 109 } |
111 | 110 |
112 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); | 111 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); |
113 if (cpsNode == null) { | 112 if (cpsNode == null) { |
114 if (irBuilderTask.bailoutMessage == null) { | 113 if (irBuilderTask.bailoutMessage == null) { |
115 giveUp('unable to build cps definition of $element'); | 114 giveUp('unable to build cps definition of $element'); |
116 } else { | 115 } else { |
117 giveUp(irBuilderTask.bailoutMessage); | 116 giveUp(irBuilderTask.bailoutMessage); |
118 } | 117 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // TODO(sigurdm): Make a better list of tasks. | 222 // TODO(sigurdm): Make a better list of tasks. |
224 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 223 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
225 } | 224 } |
226 | 225 |
227 js.Node attachPosition(js.Node node, AstElement element) { | 226 js.Node attachPosition(js.Node node, AstElement element) { |
228 return node.withSourceInformation( | 227 return node.withSourceInformation( |
229 sourceInformationFactory.forContext(element) | 228 sourceInformationFactory.forContext(element) |
230 .buildDeclaration(element)); | 229 .buildDeclaration(element)); |
231 } | 230 } |
232 } | 231 } |
OLD | NEW |