| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 cps.FunctionDefinition compileToCpsIR(AstElement element) { | 102 cps.FunctionDefinition compileToCpsIR(AstElement element) { |
| 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 if (irBuilderTask.bailoutMessage == null) { |
| 112 giveUp('unable to build cps definition of $element'); |
| 113 } else { |
| 114 giveUp(irBuilderTask.bailoutMessage); |
| 115 } |
| 112 } | 116 } |
| 113 if (element.isInstanceMember && !element.isGenerativeConstructorBody) { | 117 if (element.isInstanceMember && !element.isGenerativeConstructorBody) { |
| 114 Selector selector = new Selector.fromElement(cpsNode.element); | 118 Selector selector = new Selector.fromElement(cpsNode.element); |
| 115 if (glue.isInterceptedSelector(selector)) { | 119 if (glue.isInterceptedSelector(selector)) { |
| 116 giveUp('cannot compile methods that need interceptor calling ' | 120 giveUp('cannot compile methods that need interceptor calling ' |
| 117 'convention.'); | 121 'convention.'); |
| 118 } | 122 } |
| 119 } | 123 } |
| 120 traceGraph("IR Builder", cpsNode); | 124 traceGraph("IR Builder", cpsNode); |
| 121 new UnsugarVisitor(glue).rewrite(cpsNode); | 125 new UnsugarVisitor(glue).rewrite(cpsNode); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 Iterable<CompilerTask> get tasks { | 226 Iterable<CompilerTask> get tasks { |
| 223 // TODO(sigurdm): Make a better list of tasks. | 227 // TODO(sigurdm): Make a better list of tasks. |
| 224 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 228 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
| 225 } | 229 } |
| 226 | 230 |
| 227 js.Node attachPosition(js.Node node, AstElement element) { | 231 js.Node attachPosition(js.Node node, AstElement element) { |
| 228 return node.withSourceInformation( | 232 return node.withSourceInformation( |
| 229 StartEndSourceInformation.computeSourceInformation(element)); | 233 StartEndSourceInformation.computeSourceInformation(element)); |
| 230 } | 234 } |
| 231 } | 235 } |
| OLD | NEW |