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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 | 7 |
8 class OldEmitter implements Emitter { | 8 class OldEmitter implements Emitter { |
9 final Compiler compiler; | 9 final Compiler compiler; |
10 final CodeEmitterTask task; | 10 final CodeEmitterTask task; |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 bool inMainUnit = (outputUnit == compiler.deferredLoadTask.mainOutputUnit); | 544 bool inMainUnit = (outputUnit == compiler.deferredLoadTask.mainOutputUnit); |
545 JavaScriptConstantCompiler handler = backend.constants; | 545 JavaScriptConstantCompiler handler = backend.constants; |
546 List<jsAst.Statement> parts = <jsAst.Statement>[]; | 546 List<jsAst.Statement> parts = <jsAst.Statement>[]; |
547 | 547 |
548 Iterable<Element> fields = task.outputStaticNonFinalFieldLists[outputUnit]; | 548 Iterable<Element> fields = task.outputStaticNonFinalFieldLists[outputUnit]; |
549 // If the outputUnit does not contain any static non-final fields, then | 549 // If the outputUnit does not contain any static non-final fields, then |
550 // [fields] is `null`. | 550 // [fields] is `null`. |
551 if (fields != null) { | 551 if (fields != null) { |
552 for (Element element in fields) { | 552 for (Element element in fields) { |
553 compiler.withCurrentElement(element, () { | 553 compiler.withCurrentElement(element, () { |
554 ConstantValue constant = handler.getInitialValueFor(element).value; | 554 ConstantValue constant = handler.getInitialValueFor(element); |
555 parts.add(buildInitialization(element, constantReference(constant))); | 555 parts.add(buildInitialization(element, constantReference(constant))); |
556 }); | 556 }); |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 if (inMainUnit && task.outputStaticNonFinalFieldLists.length > 1) { | 560 if (inMainUnit && task.outputStaticNonFinalFieldLists.length > 1) { |
561 // In the main output-unit we output a stub initializer for deferred | 561 // In the main output-unit we output a stub initializer for deferred |
562 // variables, so that `isolateProperties` stays a fast object. | 562 // variables, so that `isolateProperties` stays a fast object. |
563 task.outputStaticNonFinalFieldLists.forEach( | 563 task.outputStaticNonFinalFieldLists.forEach( |
564 (OutputUnit fieldsOutputUnit, Iterable<VariableElement> fields) { | 564 (OutputUnit fieldsOutputUnit, Iterable<VariableElement> fields) { |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 1980 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
1981 if (element.isInstanceMember) { | 1981 if (element.isInstanceMember) { |
1982 cachedClassBuilders.remove(element.enclosingClass); | 1982 cachedClassBuilders.remove(element.enclosingClass); |
1983 | 1983 |
1984 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 1984 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
1985 | 1985 |
1986 } | 1986 } |
1987 } | 1987 } |
1988 } | 1988 } |
1989 } | 1989 } |
OLD | NEW |