Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: pkg/compiler/lib/src/compiler.dart

Issue 2070493003: Revert "Remove Registry from registerMetadataConstant" and "Serialize metadata" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 currentElement.enclosingClass.isEnumClass) { 1651 currentElement.enclosingClass.isEnumClass) {
1652 // Enums ASTs are synthesized (and give messed up messages). 1652 // Enums ASTs are synthesized (and give messed up messages).
1653 return true; 1653 return true;
1654 } 1654 }
1655 1655
1656 if (currentElement is AstElement) { 1656 if (currentElement is AstElement) {
1657 AstElement astElement = currentElement; 1657 AstElement astElement = currentElement;
1658 if (astElement.hasNode) { 1658 if (astElement.hasNode) {
1659 Token from = astElement.node.getBeginToken(); 1659 Token from = astElement.node.getBeginToken();
1660 Token to = astElement.node.getEndToken(); 1660 Token to = astElement.node.getEndToken();
1661 if (astElement.metadata.isNotEmpty && 1661 if (astElement.metadata.isNotEmpty) {
1662 astElement.metadata.first.hasNode) { 1662 from = astElement.metadata.first.beginToken;
1663 from = astElement.metadata.first.node.getBeginToken();
1664 } 1663 }
1665 return validateToken(from, to); 1664 return validateToken(from, to);
1666 } 1665 }
1667 } 1666 }
1668 return true; 1667 return true;
1669 }, message: "Invalid current element: $currentElement [$begin,$end].")); 1668 }, message: "Invalid current element: $currentElement [$begin,$end]."));
1670 } 1669 }
1671 return new SourceSpan.fromTokens(uri, begin, end); 1670 return new SourceSpan.fromTokens(uri, begin, end);
1672 } 1671 }
1673 1672
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 return spanFromNode(node); 1733 return spanFromNode(node);
1735 } else if (node is TokenPair) { 1734 } else if (node is TokenPair) {
1736 return spanFromTokens(node.begin, node.end); 1735 return spanFromTokens(node.begin, node.end);
1737 } else if (node is Token) { 1736 } else if (node is Token) {
1738 return spanFromTokens(node, node); 1737 return spanFromTokens(node, node);
1739 } else if (node is HInstruction) { 1738 } else if (node is HInstruction) {
1740 return spanFromHInstruction(node); 1739 return spanFromHInstruction(node);
1741 } else if (node is Element) { 1740 } else if (node is Element) {
1742 return spanFromElement(node); 1741 return spanFromElement(node);
1743 } else if (node is MetadataAnnotation) { 1742 } else if (node is MetadataAnnotation) {
1744 return node.sourcePosition; 1743 Uri uri = node.annotatedElement.compilationUnit.script.resourceUri;
1744 return spanFromTokens(node.beginToken, node.endToken, uri);
1745 } else if (node is Local) { 1745 } else if (node is Local) {
1746 Local local = node; 1746 Local local = node;
1747 return spanFromElement(local.executableContext); 1747 return spanFromElement(local.executableContext);
1748 } else { 1748 } else {
1749 throw 'No error location.'; 1749 throw 'No error location.';
1750 } 1750 }
1751 } 1751 }
1752 1752
1753 Element _elementFromHInstruction(HInstruction instruction) { 1753 Element _elementFromHInstruction(HInstruction instruction) {
1754 return instruction.sourceElement is Element 1754 return instruction.sourceElement is Element
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 _ElementScanner(this.scanner); 2101 _ElementScanner(this.scanner);
2102 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2102 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2103 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2103 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2104 } 2104 }
2105 2105
2106 class _EmptyEnvironment implements Environment { 2106 class _EmptyEnvironment implements Environment {
2107 const _EmptyEnvironment(); 2107 const _EmptyEnvironment();
2108 2108
2109 String valueOf(String key) => null; 2109 String valueOf(String key) => null;
2110 } 2110 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/constants/values.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698