| 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)) { | 16 if (Elements.isErroneous(element)) return null; |
| 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 } | |
| 23 | 17 |
| 24 WorldImpact processMetadata([WorldImpact result]) { | 18 WorldImpact processMetadata([WorldImpact result]) { |
| 25 for (MetadataAnnotation metadata in element.metadata) { | 19 for (MetadataAnnotation metadata in element.metadata) { |
| 26 metadata.ensureResolved(compiler); | 20 metadata.ensureResolved(compiler); |
| 27 } | 21 } |
| 28 return result; | 22 return result; |
| 29 } | 23 } |
| 30 | 24 |
| 31 ElementKind kind = element.kind; | 25 ElementKind kind = element.kind; |
| 32 if (identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR) || | 26 if (identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR) || |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 | 1042 |
| 1049 void reportDuplicateDefinition(String name, | 1043 void reportDuplicateDefinition(String name, |
| 1050 Spannable definition, | 1044 Spannable definition, |
| 1051 Spannable existing) { | 1045 Spannable existing) { |
| 1052 compiler.reportError(definition, | 1046 compiler.reportError(definition, |
| 1053 MessageKind.DUPLICATE_DEFINITION, {'name': name}); | 1047 MessageKind.DUPLICATE_DEFINITION, {'name': name}); |
| 1054 compiler.reportInfo(existing, | 1048 compiler.reportInfo(existing, |
| 1055 MessageKind.EXISTING_DEFINITION, {'name': name}); | 1049 MessageKind.EXISTING_DEFINITION, {'name': name}); |
| 1056 } | 1050 } |
| 1057 } | 1051 } |
| OLD | NEW |