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 assert(invariant(element, element is! ErroneousElement, | |
karlklose
2015/06/12 07:01:03
Do we have a predicate to test that instead of an
Johnni Winther
2015/06/12 07:50:30
Done.
| |
18 message: "Element $element expected to have parse errors.")); | |
19 _ensureTreeElements(element); | |
20 return const WorldImpact(); | |
21 } | |
17 | 22 |
18 WorldImpact processMetadata([WorldImpact result]) { | 23 WorldImpact processMetadata([WorldImpact result]) { |
19 for (MetadataAnnotation metadata in element.metadata) { | 24 for (MetadataAnnotation metadata in element.metadata) { |
20 metadata.ensureResolved(compiler); | 25 metadata.ensureResolved(compiler); |
21 } | 26 } |
22 return result; | 27 return result; |
23 } | 28 } |
24 | 29 |
25 ElementKind kind = element.kind; | 30 ElementKind kind = element.kind; |
26 if (identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR) || | 31 if (identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR) || |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1042 | 1047 |
1043 void reportDuplicateDefinition(String name, | 1048 void reportDuplicateDefinition(String name, |
1044 Spannable definition, | 1049 Spannable definition, |
1045 Spannable existing) { | 1050 Spannable existing) { |
1046 compiler.reportError(definition, | 1051 compiler.reportError(definition, |
1047 MessageKind.DUPLICATE_DEFINITION, {'name': name}); | 1052 MessageKind.DUPLICATE_DEFINITION, {'name': name}); |
1048 compiler.reportInfo(existing, | 1053 compiler.reportInfo(existing, |
1049 MessageKind.EXISTING_DEFINITION, {'name': name}); | 1054 MessageKind.EXISTING_DEFINITION, {'name': name}); |
1050 } | 1055 } |
1051 } | 1056 } |
OLD | NEW |