| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart2js.ir_builder; | 5 part of dart2js.ir_builder; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * This task iterates through all resolved elements and builds [ir.Node]s. The | 8 * This task iterates through all resolved elements and builds [ir.Node]s. The |
| 9 * nodes are stored in the [nodes] map and accessible through [hasIr] and | 9 * nodes are stored in the [nodes] map and accessible through [hasIr] and |
| 10 * [getIr]. | 10 * [getIr]. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 }); | 60 }); |
| 61 }); | 61 }); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool canBuild(Element element) { | 64 bool canBuild(Element element) { |
| 65 if (element is TypedefElement) return false; | 65 if (element is TypedefElement) return false; |
| 66 if (element is FunctionElement) { | 66 if (element is FunctionElement) { |
| 67 // TODO(sigurdm): Support native functions for dart2js. | 67 // TODO(sigurdm): Support native functions for dart2js. |
| 68 assert(invariant(element, !element.isNative)); | 68 assert(invariant(element, !element.isNative)); |
| 69 | 69 |
| 70 // TODO(kmillikin,sigurdm): Support constructors. | 70 if (element is ConstructorElement) { |
| 71 if (element is ConstructorElement && !element.isGenerativeConstructor) { | 71 if (!element.isGenerativeConstructor) { |
| 72 return false; | 72 // TODO(kmillikin,sigurdm): Support constructors. |
| 73 return false; |
| 74 } |
| 75 if (element.isSynthesized) { |
| 76 // Do generate CPS for synthetic constructors. |
| 77 return true; |
| 78 } |
| 73 } | 79 } |
| 74 | |
| 75 } else if (element is! FieldElement) { | 80 } else if (element is! FieldElement) { |
| 76 compiler.internalError(element, "Unexpected element type $element"); | 81 compiler.internalError(element, "Unexpected element type $element"); |
| 77 } | 82 } |
| 78 return compiler.backend.shouldOutput(element); | 83 return compiler.backend.shouldOutput(element); |
| 79 } | 84 } |
| 80 | 85 |
| 81 bool get inCheckedMode { | 86 bool get inCheckedMode { |
| 82 bool result = false; | 87 bool result = false; |
| 83 assert((result = true)); | 88 assert((result = true)); |
| 84 return result; | 89 return result; |
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 element, | 1545 element, |
| 1541 node, | 1546 node, |
| 1542 elements); | 1547 elements); |
| 1543 IrBuilder builder = | 1548 IrBuilder builder = |
| 1544 new JsIrBuilder(compiler.backend.constantSystem, element); | 1549 new JsIrBuilder(compiler.backend.constantSystem, element); |
| 1545 return withBuilder(builder, () => _makeFunctionBody(element, node)); | 1550 return withBuilder(builder, () => _makeFunctionBody(element, node)); |
| 1546 } | 1551 } |
| 1547 | 1552 |
| 1548 } | 1553 } |
| 1549 | 1554 |
| OLD | NEW |