OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:collection'; | 5 import 'dart:collection'; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
8 | 8 |
9 import '../closure.dart'; | 9 import '../closure.dart'; |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 * Invariant: [classElement] must be an implementation element. | 1180 * Invariant: [classElement] must be an implementation element. |
1181 */ | 1181 */ |
1182 void buildFieldInitializers( | 1182 void buildFieldInitializers( |
1183 ClassElement classElement, Map<Element, HInstruction> fieldValues) { | 1183 ClassElement classElement, Map<Element, HInstruction> fieldValues) { |
1184 assert(invariant(classElement, classElement.isImplementation)); | 1184 assert(invariant(classElement, classElement.isImplementation)); |
1185 classElement.forEachInstanceField( | 1185 classElement.forEachInstanceField( |
1186 (ClassElement enclosingClass, FieldElement member) { | 1186 (ClassElement enclosingClass, FieldElement member) { |
1187 if (compiler.elementHasCompileTimeError(member)) return; | 1187 if (compiler.elementHasCompileTimeError(member)) return; |
1188 reporter.withCurrentElement(member, () { | 1188 reporter.withCurrentElement(member, () { |
1189 ResolvedAst fieldResolvedAst = member.resolvedAst; | 1189 ResolvedAst fieldResolvedAst = member.resolvedAst; |
1190 ast.Node node = fieldResolvedAst.node; | |
1191 ast.Expression initializer = fieldResolvedAst.body; | 1190 ast.Expression initializer = fieldResolvedAst.body; |
1192 if (initializer == null) { | 1191 if (initializer == null) { |
1193 // Unassigned fields of native classes are not initialized to | 1192 // Unassigned fields of native classes are not initialized to |
1194 // prevent overwriting pre-initialized native properties. | 1193 // prevent overwriting pre-initialized native properties. |
1195 if (!backend.isNativeOrExtendsNative(classElement)) { | 1194 if (!backend.isNativeOrExtendsNative(classElement)) { |
1196 fieldValues[member] = graph.addConstantNull(closedWorld); | 1195 fieldValues[member] = graph.addConstantNull(closedWorld); |
1197 } | 1196 } |
1198 } else { | 1197 } else { |
1199 ast.Node right = initializer; | 1198 ast.Node right = initializer; |
1200 ResolvedAst savedResolvedAst = resolvedAst; | 1199 ResolvedAst savedResolvedAst = resolvedAst; |
(...skipping 5571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6772 this.oldReturnLocal, | 6771 this.oldReturnLocal, |
6773 this.oldReturnType, | 6772 this.oldReturnType, |
6774 this.oldResolvedAst, | 6773 this.oldResolvedAst, |
6775 this.oldStack, | 6774 this.oldStack, |
6776 this.oldLocalsHandler, | 6775 this.oldLocalsHandler, |
6777 this.inTryStatement, | 6776 this.inTryStatement, |
6778 this.allFunctionsCalledOnce, | 6777 this.allFunctionsCalledOnce, |
6779 this.oldElementInferenceResults) | 6778 this.oldElementInferenceResults) |
6780 : super(function); | 6779 : super(function); |
6781 } | 6780 } |
OLD | NEW |