Chromium Code Reviews| 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 library dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
| 6 | 6 |
| 7 import '../closure.dart' as closurelib; | 7 import '../closure.dart' as closurelib; |
| 8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2574 * creates a new constructor body, if none can be found. | 2574 * creates a new constructor body, if none can be found. |
| 2575 * | 2575 * |
| 2576 * Returns `null` if the constructor does not have a body. | 2576 * Returns `null` if the constructor does not have a body. |
| 2577 */ | 2577 */ |
| 2578 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { | 2578 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { |
| 2579 // TODO(asgerf): This is largely inherited from the SSA builder. | 2579 // TODO(asgerf): This is largely inherited from the SSA builder. |
| 2580 // The ConstructorBodyElement has an invalid function signature, but we | 2580 // The ConstructorBodyElement has an invalid function signature, but we |
| 2581 // cannot add a BoxLocal as parameter, because BoxLocal is not an element. | 2581 // cannot add a BoxLocal as parameter, because BoxLocal is not an element. |
| 2582 // Instead of forging ParameterElements to forge a FunctionSignature, we | 2582 // Instead of forging ParameterElements to forge a FunctionSignature, we |
| 2583 // need a way to create backend methods without creating more fake elements. | 2583 // need a way to create backend methods without creating more fake elements. |
| 2584 | 2584 constructor = constructor.implementation; |
|
floitsch
2015/06/22 11:46:53
I think we should always have implementations in t
| |
| 2585 assert(constructor.isGenerativeConstructor); | 2585 assert(constructor.isGenerativeConstructor); |
| 2586 assert(invariant(constructor, constructor.isImplementation)); | |
| 2587 if (constructor.isSynthesized) return null; | 2586 if (constructor.isSynthesized) return null; |
| 2588 ast.FunctionExpression node = constructor.node; | 2587 ast.FunctionExpression node = constructor.node; |
| 2589 // If we know the body doesn't have any code, we don't generate it. | 2588 // If we know the body doesn't have any code, we don't generate it. |
| 2590 if (!node.hasBody()) return null; | 2589 if (!node.hasBody()) return null; |
| 2591 if (node.hasEmptyBody()) return null; | 2590 if (node.hasEmptyBody()) return null; |
| 2592 ClassElement classElement = constructor.enclosingClass; | 2591 ClassElement classElement = constructor.enclosingClass; |
| 2593 ConstructorBodyElement bodyElement; | 2592 ConstructorBodyElement bodyElement; |
| 2594 classElement.forEachBackendMember((Element backendMember) { | 2593 classElement.forEachBackendMember((Element backendMember) { |
| 2595 if (backendMember.isGenerativeConstructorBody) { | 2594 if (backendMember.isGenerativeConstructorBody) { |
| 2596 ConstructorBodyElement body = backendMember; | 2595 ConstructorBodyElement body = backendMember; |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3137 } | 3136 } |
| 3138 | 3137 |
| 3139 processSetStatic(ir.SetStatic node) { | 3138 processSetStatic(ir.SetStatic node) { |
| 3140 node.body = replacementFor(node.body); | 3139 node.body = replacementFor(node.body); |
| 3141 } | 3140 } |
| 3142 | 3141 |
| 3143 processContinuation(ir.Continuation node) { | 3142 processContinuation(ir.Continuation node) { |
| 3144 node.body = replacementFor(node.body); | 3143 node.body = replacementFor(node.body); |
| 3145 } | 3144 } |
| 3146 } | 3145 } |
| OLD | NEW |