| 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 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2359 // All parameters in all constructors are now bound in the environment. | 2359 // All parameters in all constructors are now bound in the environment. |
| 2360 // BoxLocals for captured parameters are also in the environment. | 2360 // BoxLocals for captured parameters are also in the environment. |
| 2361 // The initial value of all fields are now bound in [fieldValues]. | 2361 // The initial value of all fields are now bound in [fieldValues]. |
| 2362 | 2362 |
| 2363 // --- Step 2: create the object --- | 2363 // --- Step 2: create the object --- |
| 2364 // Get the initial field values in the canonical order. | 2364 // Get the initial field values in the canonical order. |
| 2365 List<ir.Primitive> instanceArguments = <ir.Primitive>[]; | 2365 List<ir.Primitive> instanceArguments = <ir.Primitive>[]; |
| 2366 classElement.forEachInstanceField((ClassElement c, FieldElement field) { | 2366 classElement.forEachInstanceField((ClassElement c, FieldElement field) { |
| 2367 ir.Primitive value = fieldValues[field]; | 2367 ir.Primitive value = fieldValues[field]; |
| 2368 if (value != null) { | 2368 if (value != null) { |
| 2369 instanceArguments.add(fieldValues[field]); | 2369 instanceArguments.add(value); |
| 2370 } else { | 2370 } else { |
| 2371 assert(Elements.isNativeOrExtendsNative(c)); | 2371 assert(Elements.isNativeOrExtendsNative(c)); |
| 2372 // Native fields are initialized elsewhere. | 2372 // Native fields are initialized elsewhere. |
| 2373 } | 2373 } |
| 2374 }, includeSuperAndInjectedMembers: true); | 2374 }, includeSuperAndInjectedMembers: true); |
| 2375 ir.Primitive instance = new ir.CreateInstance( | 2375 ir.Primitive instance = new ir.CreateInstance( |
| 2376 classElement, | 2376 classElement, |
| 2377 instanceArguments, | 2377 instanceArguments, |
| 2378 typeInformation); | 2378 typeInformation); |
| 2379 irBuilder.add(new ir.LetPrim(instance)); | 2379 irBuilder.add(new ir.LetPrim(instance)); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2822 node.body = replacementFor(node.body); | 2822 node.body = replacementFor(node.body); |
| 2823 } | 2823 } |
| 2824 } | 2824 } |
| 2825 | 2825 |
| 2826 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 2826 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
| 2827 class RemovalVisitor extends ir.RecursiveVisitor { | 2827 class RemovalVisitor extends ir.RecursiveVisitor { |
| 2828 processReference(ir.Reference reference) { | 2828 processReference(ir.Reference reference) { |
| 2829 reference.unlink(); | 2829 reference.unlink(); |
| 2830 } | 2830 } |
| 2831 } | 2831 } |
| OLD | NEW |