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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 /** | 7 /** |
8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
9 * compiled. | 9 * compiled. |
10 */ | 10 */ |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 log('Excess resolution work: ${resolved.length}.'); | 1035 log('Excess resolution work: ${resolved.length}.'); |
1036 for (Element e in resolved) { | 1036 for (Element e in resolved) { |
1037 SourceSpan span = spanFromElement(e); | 1037 SourceSpan span = spanFromElement(e); |
1038 reportDiagnostic(span, 'Warning: $e resolved but not compiled.', | 1038 reportDiagnostic(span, 'Warning: $e resolved but not compiled.', |
1039 api.Diagnostic.WARNING); | 1039 api.Diagnostic.WARNING); |
1040 } | 1040 } |
1041 } | 1041 } |
1042 | 1042 |
1043 TreeElements analyzeElement(Element element) { | 1043 TreeElements analyzeElement(Element element) { |
1044 assert(invariant(element, element.isDeclaration)); | 1044 assert(invariant(element, element.isDeclaration)); |
1045 assert(!element.isForwardingConstructor); | |
1046 ResolutionEnqueuer world = enqueuer.resolution; | 1045 ResolutionEnqueuer world = enqueuer.resolution; |
1047 TreeElements elements = world.getCachedElements(element); | 1046 TreeElements elements = world.getCachedElements(element); |
1048 if (elements != null) return elements; | 1047 if (elements != null) return elements; |
1049 assert(parser != null); | 1048 assert(parser != null); |
1050 Node tree = parser.parse(element); | 1049 Node tree = parser.parse(element); |
1051 validator.validate(tree); | 1050 assert(invariant(element, !element.isSynthesized || tree == null)); |
| 1051 if (tree != null) validator.validate(tree); |
1052 elements = resolver.resolve(element); | 1052 elements = resolver.resolve(element); |
1053 if (elements != null && !analyzeSignaturesOnly) { | 1053 if (tree != null && elements != null && !analyzeSignaturesOnly) { |
1054 // Only analyze nodes with a corresponding [TreeElements]. | 1054 // Only analyze nodes with a corresponding [TreeElements]. |
1055 checker.check(elements); | 1055 checker.check(elements); |
1056 } | 1056 } |
1057 world.resolvedElements[element] = elements; | 1057 world.resolvedElements[element] = elements; |
1058 return elements; | 1058 return elements; |
1059 } | 1059 } |
1060 | 1060 |
1061 TreeElements analyze(ResolutionWorkItem work, ResolutionEnqueuer world) { | 1061 TreeElements analyze(ResolutionWorkItem work, ResolutionEnqueuer world) { |
1062 assert(invariant(work.element, identical(world, enqueuer.resolution))); | 1062 assert(invariant(work.element, identical(world, enqueuer.resolution))); |
1063 assert(invariant(work.element, !work.isAnalyzed(), | 1063 assert(invariant(work.element, !work.isAnalyzed(), |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 | 1449 |
1450 void close() {} | 1450 void close() {} |
1451 | 1451 |
1452 toString() => name; | 1452 toString() => name; |
1453 | 1453 |
1454 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1454 /// Convenience method for getting an [api.CompilerOutputProvider]. |
1455 static NullSink outputProvider(String name, String extension) { | 1455 static NullSink outputProvider(String name, String extension) { |
1456 return new NullSink('$name.$extension'); | 1456 return new NullSink('$name.$extension'); |
1457 } | 1457 } |
1458 } | 1458 } |
OLD | NEW |