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 Identifiers; | 10 import '../common/names.dart' show Identifiers; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (result.isConstant) { | 393 if (result.isConstant) { |
394 element.constant = result.constant; | 394 element.constant = result.constant; |
395 } | 395 } |
396 } else if (modifiers.isConst) { | 396 } else if (modifiers.isConst) { |
397 reporter.reportErrorMessage( | 397 reporter.reportErrorMessage( |
398 element, MessageKind.CONST_WITHOUT_INITIALIZER); | 398 element, MessageKind.CONST_WITHOUT_INITIALIZER); |
399 } else if (modifiers.isFinal && !element.isInstanceMember) { | 399 } else if (modifiers.isFinal && !element.isInstanceMember) { |
400 reporter.reportErrorMessage( | 400 reporter.reportErrorMessage( |
401 element, MessageKind.FINAL_WITHOUT_INITIALIZER); | 401 element, MessageKind.FINAL_WITHOUT_INITIALIZER); |
402 } else { | 402 } else { |
403 // TODO(johnniwinther): Register a feature instead. | 403 registry.registerFeature(Feature.FIELD_WITHOUT_INITIALIZER); |
404 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.nullType)); | |
405 } | 404 } |
406 | 405 |
407 if (Elements.isStaticOrTopLevelField(element)) { | 406 if (Elements.isStaticOrTopLevelField(element)) { |
408 visitor.addDeferredAction(element, () { | 407 visitor.addDeferredAction(element, () { |
409 if (element.modifiers.isConst) { | 408 if (element.modifiers.isConst) { |
410 element.constant = constantCompiler.compileConstant(element); | 409 element.constant = constantCompiler.compileConstant(element); |
411 } else { | 410 } else { |
412 element.constant = constantCompiler.compileVariable(element); | 411 element.constant = constantCompiler.compileVariable(element); |
413 } | 412 } |
414 }); | 413 }); |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 TreeElements get treeElements { | 1122 TreeElements get treeElements { |
1124 assert(invariant(this, _treeElements != null, | 1123 assert(invariant(this, _treeElements != null, |
1125 message: "TreeElements have not been computed for $this.")); | 1124 message: "TreeElements have not been computed for $this.")); |
1126 return _treeElements; | 1125 return _treeElements; |
1127 } | 1126 } |
1128 | 1127 |
1129 void reuseElement() { | 1128 void reuseElement() { |
1130 _treeElements = null; | 1129 _treeElements = null; |
1131 } | 1130 } |
1132 } | 1131 } |
OLD | NEW |