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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 return reporter.withCurrentElement(element, () { | 353 return reporter.withCurrentElement(element, () { |
354 VariableDefinitions tree = element.parseNode(parsingContext); | 354 VariableDefinitions tree = element.parseNode(parsingContext); |
355 if (element.modifiers.isStatic && element.isTopLevel) { | 355 if (element.modifiers.isStatic && element.isTopLevel) { |
356 reporter.reportErrorMessage(element.modifiers.getStatic(), | 356 reporter.reportErrorMessage(element.modifiers.getStatic(), |
357 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC); | 357 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC); |
358 } | 358 } |
359 ResolverVisitor visitor = visitorFor(element); | 359 ResolverVisitor visitor = visitorFor(element); |
360 ResolutionRegistry registry = visitor.registry; | 360 ResolutionRegistry registry = visitor.registry; |
361 // TODO(johnniwinther): Maybe remove this when placeholderCollector migrat
es | 361 // TODO(johnniwinther): Maybe remove this when placeholderCollector migrat
es |
362 // to the backend ast. | 362 // to the backend ast. |
363 registry.defineElement(tree.definitions.nodes.head, element); | 363 registry.defineElement(element.definition, element); |
364 // TODO(johnniwinther): Share the resolved type between all variables | 364 // TODO(johnniwinther): Share the resolved type between all variables |
365 // declared in the same declaration. | 365 // declared in the same declaration. |
366 if (tree.type != null) { | 366 if (tree.type != null) { |
367 DartType type = visitor.resolveTypeAnnotation(tree.type); | 367 DartType type = visitor.resolveTypeAnnotation(tree.type); |
368 assert(invariant( | 368 assert(invariant( |
369 element, | 369 element, |
370 element.variables.type == null || | 370 element.variables.type == null || |
371 // Crude check but we have no equivalence relation that | 371 // Crude check but we have no equivalence relation that |
372 // equates malformed types, like matching creations of type | 372 // equates malformed types, like matching creations of type |
373 // `Foo<Unresolved>`. | 373 // `Foo<Unresolved>`. |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 TreeElements get treeElements { | 1121 TreeElements get treeElements { |
1122 assert(invariant(this, _treeElements != null, | 1122 assert(invariant(this, _treeElements != null, |
1123 message: "TreeElements have not been computed for $this.")); | 1123 message: "TreeElements have not been computed for $this.")); |
1124 return _treeElements; | 1124 return _treeElements; |
1125 } | 1125 } |
1126 | 1126 |
1127 void reuseElement() { | 1127 void reuseElement() { |
1128 _treeElements = null; | 1128 _treeElements = null; |
1129 } | 1129 } |
1130 } | 1130 } |
OLD | NEW |