| 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 library dart2js.resolution; | 5 library dart2js.resolution; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show | 10 import '../common/names.dart' show |
| 11 Identifiers; | 11 Identifiers; |
| 12 import '../common/resolution.dart' show | 12 import '../common/resolution.dart' show |
| 13 Feature, |
| 13 Parsing, | 14 Parsing, |
| 14 Resolution, | 15 Resolution, |
| 15 ResolutionImpact; | 16 ResolutionImpact; |
| 16 import '../common/tasks.dart' show | 17 import '../common/tasks.dart' show |
| 17 CompilerTask, | 18 CompilerTask, |
| 18 DeferredAction; | 19 DeferredAction; |
| 19 import '../compiler.dart' show | 20 import '../compiler.dart' show |
| 20 Compiler; | 21 Compiler; |
| 21 import '../compile_time_constants.dart' show | 22 import '../compile_time_constants.dart' show |
| 22 ConstantCompiler; | 23 ConstantCompiler; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 183 |
| 183 } | 184 } |
| 184 if (functionExpression.body.asReturn() != null && | 185 if (functionExpression.body.asReturn() != null && |
| 185 element.asyncMarker.isYielding) { | 186 element.asyncMarker.isYielding) { |
| 186 reporter.reportErrorMessage( | 187 reporter.reportErrorMessage( |
| 187 asyncModifier, | 188 asyncModifier, |
| 188 MessageKind.YIELDING_MODIFIER_ON_ARROW_BODY, | 189 MessageKind.YIELDING_MODIFIER_ON_ARROW_BODY, |
| 189 {'modifier': element.asyncMarker}); | 190 {'modifier': element.asyncMarker}); |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 registry.registerAsyncMarker(element); | |
| 193 switch (element.asyncMarker) { | 193 switch (element.asyncMarker) { |
| 194 case AsyncMarker.ASYNC: | 194 case AsyncMarker.ASYNC: |
| 195 registry.registerFeature(Feature.ASYNC); |
| 195 coreClasses.futureClass.ensureResolved(resolution); | 196 coreClasses.futureClass.ensureResolved(resolution); |
| 196 break; | 197 break; |
| 197 case AsyncMarker.ASYNC_STAR: | 198 case AsyncMarker.ASYNC_STAR: |
| 199 registry.registerFeature(Feature.ASYNC_STAR); |
| 198 coreClasses.streamClass.ensureResolved(resolution); | 200 coreClasses.streamClass.ensureResolved(resolution); |
| 199 break; | 201 break; |
| 200 case AsyncMarker.SYNC_STAR: | 202 case AsyncMarker.SYNC_STAR: |
| 203 registry.registerFeature(Feature.SYNC_STAR); |
| 201 coreClasses.iterableClass.ensureResolved(resolution); | 204 coreClasses.iterableClass.ensureResolved(resolution); |
| 202 break; | 205 break; |
| 203 } | 206 } |
| 204 } | 207 } |
| 205 } | 208 } |
| 206 | 209 |
| 207 bool _isNativeClassOrExtendsNativeClass(ClassElement classElement) { | 210 bool _isNativeClassOrExtendsNativeClass(ClassElement classElement) { |
| 208 assert(classElement != null); | 211 assert(classElement != null); |
| 209 while (classElement != null) { | 212 while (classElement != null) { |
| 210 if (compiler.backend.isNative(classElement)) return true; | 213 if (compiler.backend.isNative(classElement)) return true; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if (element.modifiers.isConst) { | 393 if (element.modifiers.isConst) { |
| 391 element.constant = constantCompiler.compileConstant(element); | 394 element.constant = constantCompiler.compileConstant(element); |
| 392 } else { | 395 } else { |
| 393 constantCompiler.compileVariable(element); | 396 constantCompiler.compileVariable(element); |
| 394 } | 397 } |
| 395 }); | 398 }); |
| 396 if (initializer != null) { | 399 if (initializer != null) { |
| 397 if (!element.modifiers.isConst) { | 400 if (!element.modifiers.isConst) { |
| 398 // TODO(johnniwinther): Determine the const-ness eagerly to avoid | 401 // TODO(johnniwinther): Determine the const-ness eagerly to avoid |
| 399 // unnecessary registrations. | 402 // unnecessary registrations. |
| 400 registry.registerLazyField(); | 403 registry.registerFeature(Feature.LAZY_FIELD); |
| 401 } | 404 } |
| 402 } | 405 } |
| 403 } | 406 } |
| 404 | 407 |
| 405 // Perform various checks as side effect of "computing" the type. | 408 // Perform various checks as side effect of "computing" the type. |
| 406 element.computeType(resolution); | 409 element.computeType(resolution); |
| 407 | 410 |
| 408 return registry.worldImpact; | 411 return registry.worldImpact; |
| 409 } | 412 } |
| 410 | 413 |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 TreeElements get treeElements { | 1097 TreeElements get treeElements { |
| 1095 assert(invariant(this, _treeElements !=null, | 1098 assert(invariant(this, _treeElements !=null, |
| 1096 message: "TreeElements have not been computed for $this.")); | 1099 message: "TreeElements have not been computed for $this.")); |
| 1097 return _treeElements; | 1100 return _treeElements; |
| 1098 } | 1101 } |
| 1099 | 1102 |
| 1100 void reuseElement() { | 1103 void reuseElement() { |
| 1101 _treeElements = null; | 1104 _treeElements = null; |
| 1102 } | 1105 } |
| 1103 } | 1106 } |
| OLD | NEW |