| 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 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 from = astElement.metadata.first.beginToken; | 1662 astElement.metadata.first.hasNode) { |
| 1663 from = astElement.metadata.first.node.getBeginToken(); |
| 1663 } | 1664 } |
| 1664 return validateToken(from, to); | 1665 return validateToken(from, to); |
| 1665 } | 1666 } |
| 1666 } | 1667 } |
| 1667 return true; | 1668 return true; |
| 1668 }, message: "Invalid current element: $currentElement [$begin,$end].")); | 1669 }, message: "Invalid current element: $currentElement [$begin,$end].")); |
| 1669 } | 1670 } |
| 1670 return new SourceSpan.fromTokens(uri, begin, end); | 1671 return new SourceSpan.fromTokens(uri, begin, end); |
| 1671 } | 1672 } |
| 1672 | 1673 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 return spanFromNode(node); | 1734 return spanFromNode(node); |
| 1734 } else if (node is TokenPair) { | 1735 } else if (node is TokenPair) { |
| 1735 return spanFromTokens(node.begin, node.end); | 1736 return spanFromTokens(node.begin, node.end); |
| 1736 } else if (node is Token) { | 1737 } else if (node is Token) { |
| 1737 return spanFromTokens(node, node); | 1738 return spanFromTokens(node, node); |
| 1738 } else if (node is HInstruction) { | 1739 } else if (node is HInstruction) { |
| 1739 return spanFromHInstruction(node); | 1740 return spanFromHInstruction(node); |
| 1740 } else if (node is Element) { | 1741 } else if (node is Element) { |
| 1741 return spanFromElement(node); | 1742 return spanFromElement(node); |
| 1742 } else if (node is MetadataAnnotation) { | 1743 } else if (node is MetadataAnnotation) { |
| 1743 Uri uri = node.annotatedElement.compilationUnit.script.resourceUri; | 1744 return node.sourcePosition; |
| 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 Loading... |
| 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 } |
| OLD | NEW |