| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 void traceGraph(String title, var irObject) { | 91 void traceGraph(String title, var irObject) { |
| 92 if (tracer != null) { | 92 if (tracer != null) { |
| 93 tracer.traceGraph(title, irObject); | 93 tracer.traceGraph(title, irObject); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 cps.FunctionDefinition compileToCpsIR(AstElement element) { | 97 cps.FunctionDefinition compileToCpsIR(AstElement element) { |
| 98 // TODO(sigurdm): Support these constructs. | 98 // TODO(sigurdm): Support these constructs. |
| 99 if (element.isGenerativeConstructorBody || | 99 if (element.isNative || |
| 100 element.isNative || | |
| 101 element.isField) { | 100 element.isField) { |
| 102 giveUp('unsupported element kind: ${element.name}:${element.kind}'); | 101 giveUp('unsupported element kind: ${element.name}:${element.kind}'); |
| 103 } | 102 } |
| 104 | 103 |
| 105 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); | 104 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); |
| 106 if (cpsNode == null) { | 105 if (cpsNode == null) { |
| 107 giveUp('unable to build cps definition of $element'); | 106 giveUp('unable to build cps definition of $element'); |
| 108 } | 107 } |
| 109 traceGraph("IR Builder", cpsNode); | 108 traceGraph("IR Builder", cpsNode); |
| 110 new UnsugarVisitor(glue).rewrite(cpsNode); | 109 new UnsugarVisitor(glue).rewrite(cpsNode); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 endSourcePosition = | 225 endSourcePosition = |
| 227 new TokenSourceFileLocation(sourceFile, endToken, name); | 226 new TokenSourceFileLocation(sourceFile, endToken, name); |
| 228 } | 227 } |
| 229 return node.withPosition(sourcePosition, endSourcePosition); | 228 return node.withPosition(sourcePosition, endSourcePosition); |
| 230 } | 229 } |
| 231 | 230 |
| 232 SourceFile sourceFileOfElement(Element element) { | 231 SourceFile sourceFileOfElement(Element element) { |
| 233 return element.implementation.compilationUnit.script.file; | 232 return element.implementation.compilationUnit.script.file; |
| 234 } | 233 } |
| 235 } | 234 } |
| OLD | NEW |