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.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
8 | 8 |
9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
10 import 'cache_strategy.dart' show CacheStrategy; | 10 import 'cache_strategy.dart' show CacheStrategy; |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 .log('Resolved ${enqueuer.resolution.processedElements.length} ' | 1057 .log('Resolved ${enqueuer.resolution.processedElements.length} ' |
1058 'elements.'); | 1058 'elements.'); |
1059 progress.reset(); | 1059 progress.reset(); |
1060 } | 1060 } |
1061 } | 1061 } |
1062 AstElement element = work.element; | 1062 AstElement element = work.element; |
1063 if (world.hasBeenProcessed(element)) { | 1063 if (world.hasBeenProcessed(element)) { |
1064 return const WorldImpact(); | 1064 return const WorldImpact(); |
1065 } | 1065 } |
1066 WorldImpact worldImpact = analyzeElement(element); | 1066 WorldImpact worldImpact = analyzeElement(element); |
1067 backend.onElementResolved(element); | |
1068 world.registerProcessedElement(element); | 1067 world.registerProcessedElement(element); |
1069 return worldImpact; | 1068 return worldImpact; |
1070 }); | 1069 }); |
1071 | 1070 |
1072 WorldImpact codegen(CodegenWorkItem work, CodegenEnqueuer world) { | 1071 WorldImpact codegen(CodegenWorkItem work, CodegenEnqueuer world) { |
1073 assert(invariant(work.element, identical(world, enqueuer.codegen))); | 1072 assert(invariant(work.element, identical(world, enqueuer.codegen))); |
1074 if (shouldPrintProgress) { | 1073 if (shouldPrintProgress) { |
1075 // TODO(ahe): Add structured diagnostics to the compiler API and | 1074 // TODO(ahe): Add structured diagnostics to the compiler API and |
1076 // use it to separate this from the --verbose option. | 1075 // use it to separate this from the --verbose option. |
1077 reporter | 1076 reporter |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 currentElement.enclosingClass.isEnumClass) { | 1650 currentElement.enclosingClass.isEnumClass) { |
1652 // Enums ASTs are synthesized (and give messed up messages). | 1651 // Enums ASTs are synthesized (and give messed up messages). |
1653 return true; | 1652 return true; |
1654 } | 1653 } |
1655 | 1654 |
1656 if (currentElement is AstElement) { | 1655 if (currentElement is AstElement) { |
1657 AstElement astElement = currentElement; | 1656 AstElement astElement = currentElement; |
1658 if (astElement.hasNode) { | 1657 if (astElement.hasNode) { |
1659 Token from = astElement.node.getBeginToken(); | 1658 Token from = astElement.node.getBeginToken(); |
1660 Token to = astElement.node.getEndToken(); | 1659 Token to = astElement.node.getEndToken(); |
1661 if (astElement.metadata.isNotEmpty && | 1660 if (astElement.metadata.isNotEmpty) { |
1662 astElement.metadata.first.hasNode) { | 1661 if (!astElement.metadata.first.hasNode) { |
| 1662 // We might try to report an error while parsing the metadata |
| 1663 // itself. |
| 1664 return true; |
| 1665 } |
1663 from = astElement.metadata.first.node.getBeginToken(); | 1666 from = astElement.metadata.first.node.getBeginToken(); |
1664 } | 1667 } |
1665 return validateToken(from, to); | 1668 return validateToken(from, to); |
1666 } | 1669 } |
1667 } | 1670 } |
1668 return true; | 1671 return true; |
1669 }, message: "Invalid current element: $currentElement [$begin,$end].")); | 1672 }, message: "Invalid current element: $currentElement [$begin,$end].")); |
1670 } | 1673 } |
1671 return new SourceSpan.fromTokens(uri, begin, end); | 1674 return new SourceSpan.fromTokens(uri, begin, end); |
1672 } | 1675 } |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 _ElementScanner(this.scanner); | 2104 _ElementScanner(this.scanner); |
2102 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2105 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2103 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2106 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2104 } | 2107 } |
2105 | 2108 |
2106 class _EmptyEnvironment implements Environment { | 2109 class _EmptyEnvironment implements Environment { |
2107 const _EmptyEnvironment(); | 2110 const _EmptyEnvironment(); |
2108 | 2111 |
2109 String valueOf(String key) => null; | 2112 String valueOf(String key) => null; |
2110 } | 2113 } |
OLD | NEW |