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 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 | 1785 |
1786 SourceSpan spanFromHInstruction(HInstruction instruction) { | 1786 SourceSpan spanFromHInstruction(HInstruction instruction) { |
1787 Element element = _elementFromHInstruction(instruction); | 1787 Element element = _elementFromHInstruction(instruction); |
1788 if (element == null) element = currentElement; | 1788 if (element == null) element = currentElement; |
1789 SourceInformation position = instruction.sourceInformation; | 1789 SourceInformation position = instruction.sourceInformation; |
1790 if (position == null) return spanFromElement(element); | 1790 if (position == null) return spanFromElement(element); |
1791 return position.sourceSpan; | 1791 return position.sourceSpan; |
1792 } | 1792 } |
1793 | 1793 |
1794 SourceSpan spanFromSpannable(Spannable node) { | 1794 SourceSpan spanFromSpannable(Spannable node) { |
1795 // TODO(johnniwinther): Disallow `node == null` ? | |
1796 if (node == null) return null; | |
1797 if (node == CURRENT_ELEMENT_SPANNABLE) { | 1795 if (node == CURRENT_ELEMENT_SPANNABLE) { |
1798 node = currentElement; | 1796 node = currentElement; |
1799 } else if (node == NO_LOCATION_SPANNABLE) { | 1797 } else if (node == NO_LOCATION_SPANNABLE) { |
1800 if (currentElement == null) return null; | 1798 if (currentElement == null) return null; |
1801 node = currentElement; | 1799 node = currentElement; |
1802 } | 1800 } |
1803 if (node is SourceSpan) { | 1801 if (node is SourceSpan) { |
1804 return node; | 1802 return node; |
1805 } else if (node is Node) { | 1803 } else if (node is Node) { |
1806 return spanFromNode(node); | 1804 return spanFromNode(node); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 _ElementScanner(this.scanner); | 2248 _ElementScanner(this.scanner); |
2251 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2249 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2252 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2250 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2253 } | 2251 } |
2254 | 2252 |
2255 class _EmptyEnvironment implements Environment { | 2253 class _EmptyEnvironment implements Environment { |
2256 const _EmptyEnvironment(); | 2254 const _EmptyEnvironment(); |
2257 | 2255 |
2258 String valueOf(String key) => null; | 2256 String valueOf(String key) => null; |
2259 } | 2257 } |
OLD | NEW |