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 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 | 1911 |
1912 @override | 1912 @override |
1913 void ensureResolved(Element element) { | 1913 void ensureResolved(Element element) { |
1914 if (compiler.serialization.isDeserialized(element)) { | 1914 if (compiler.serialization.isDeserialized(element)) { |
1915 return; | 1915 return; |
1916 } | 1916 } |
1917 computeWorldImpact(element); | 1917 computeWorldImpact(element); |
1918 } | 1918 } |
1919 | 1919 |
1920 @override | 1920 @override |
1921 bool hasResolvedAst(Element element) { | 1921 bool hasResolvedAst(ExecutableElement element) { |
1922 assert(invariant(element, element.isDeclaration, | 1922 assert(invariant(element, element.isDeclaration, |
1923 message: "Element $element must be the declaration.")); | 1923 message: "Element $element must be the declaration.")); |
1924 if (compiler.serialization.isDeserialized(element)) { | 1924 if (compiler.serialization.isDeserialized(element)) { |
1925 return compiler.serialization.hasResolvedAst(element); | 1925 return compiler.serialization.hasResolvedAst(element); |
1926 } | 1926 } |
1927 return element is AstElement && | 1927 return hasBeenResolved(element.memberContext.declaration) && |
1928 hasBeenResolved(element) && | |
1929 element.hasResolvedAst; | 1928 element.hasResolvedAst; |
1930 } | 1929 } |
1931 | 1930 |
1932 @override | 1931 @override |
1933 ResolvedAst getResolvedAst(Element element) { | 1932 ResolvedAst getResolvedAst(ExecutableElement element) { |
1934 assert(invariant(element, element.isDeclaration, | 1933 assert(invariant(element, element.isDeclaration, |
1935 message: "Element $element must be the declaration.")); | 1934 message: "Element $element must be the declaration.")); |
1936 if (hasResolvedAst(element)) { | 1935 if (hasResolvedAst(element)) { |
1937 if (compiler.serialization.isDeserialized(element)) { | 1936 if (compiler.serialization.isDeserialized(element)) { |
1938 return compiler.serialization.getResolvedAst(element); | 1937 return compiler.serialization.getResolvedAst(element); |
1939 } | 1938 } |
1940 AstElement astElement = element; | 1939 return element.resolvedAst; |
1941 return astElement.resolvedAst; | |
1942 } | 1940 } |
1943 assert(invariant(element, hasResolvedAst(element), | 1941 assert(invariant(element, hasResolvedAst(element), |
1944 message: "ResolvedAst not available for $element.")); | 1942 message: "ResolvedAst not available for $element.")); |
1945 return null; | 1943 return null; |
1946 } | 1944 } |
1947 | 1945 |
1948 @override | 1946 @override |
1949 ResolvedAst computeResolvedAst(Element element) { | 1947 ResolvedAst computeResolvedAst(Element element) { |
1950 ensureResolved(element); | 1948 ensureResolved(element); |
1951 return getResolvedAst(element); | 1949 return getResolvedAst(element); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 _ElementScanner(this.scanner); | 2096 _ElementScanner(this.scanner); |
2099 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2097 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2100 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2098 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2101 } | 2099 } |
2102 | 2100 |
2103 class _EmptyEnvironment implements Environment { | 2101 class _EmptyEnvironment implements Environment { |
2104 const _EmptyEnvironment(); | 2102 const _EmptyEnvironment(); |
2105 | 2103 |
2106 String valueOf(String key) => null; | 2104 String valueOf(String key) => null; |
2107 } | 2105 } |
OLD | NEW |