OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 resolution; | 5 part of resolution; |
6 | 6 |
7 class ResolverTask extends CompilerTask { | 7 class ResolverTask extends CompilerTask { |
8 final ConstantCompiler constantCompiler; | 8 final ConstantCompiler constantCompiler; |
9 | 9 |
10 ResolverTask(Compiler compiler, this.constantCompiler) : super(compiler); | 10 ResolverTask(Compiler compiler, this.constantCompiler) : super(compiler); |
11 | 11 |
12 String get name => 'Resolver'; | 12 String get name => 'Resolver'; |
13 | 13 |
14 WorldImpact resolve(Element element) { | 14 WorldImpact resolve(Element element) { |
15 return measure(() { | 15 return measure(() { |
16 if (Elements.isErroneous(element)) return null; | 16 if (Elements.isErroneous(element)) { |
| 17 // TODO(johnniwinther): Add a predicate for this. |
| 18 assert(invariant(element, element is! ErroneousElement, |
| 19 message: "Element $element expected to have parse errors.")); |
| 20 _ensureTreeElements(element); |
| 21 return const WorldImpact(); |
| 22 } |
17 | 23 |
18 WorldImpact processMetadata([WorldImpact result]) { | 24 WorldImpact processMetadata([WorldImpact result]) { |
19 for (MetadataAnnotation metadata in element.metadata) { | 25 for (MetadataAnnotation metadata in element.metadata) { |
20 metadata.ensureResolved(compiler); | 26 metadata.ensureResolved(compiler); |
21 } | 27 } |
22 return result; | 28 return result; |
23 } | 29 } |
24 | 30 |
25 ElementKind kind = element.kind; | 31 ElementKind kind = element.kind; |
26 if (identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR) || | 32 if (identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR) || |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 | 1048 |
1043 void reportDuplicateDefinition(String name, | 1049 void reportDuplicateDefinition(String name, |
1044 Spannable definition, | 1050 Spannable definition, |
1045 Spannable existing) { | 1051 Spannable existing) { |
1046 compiler.reportError(definition, | 1052 compiler.reportError(definition, |
1047 MessageKind.DUPLICATE_DEFINITION, {'name': name}); | 1053 MessageKind.DUPLICATE_DEFINITION, {'name': name}); |
1048 compiler.reportInfo(existing, | 1054 compiler.reportInfo(existing, |
1049 MessageKind.EXISTING_DEFINITION, {'name': name}); | 1055 MessageKind.EXISTING_DEFINITION, {'name': name}); |
1050 } | 1056 } |
1051 } | 1057 } |
OLD | NEW |