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

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

Issue 1917863002: Replace _analyzeElementEagerly with Resolution.ensureResolved (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: dartfmt Created 4 years, 8 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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 FunctionSignature resolveSignature(FunctionElement function) { 1840 FunctionSignature resolveSignature(FunctionElement function) {
1841 return compiler.resolver.resolveSignature(function); 1841 return compiler.resolver.resolveSignature(function);
1842 } 1842 }
1843 1843
1844 @override 1844 @override
1845 DartType resolveTypeAnnotation(Element element, TypeAnnotation node) { 1845 DartType resolveTypeAnnotation(Element element, TypeAnnotation node) {
1846 return compiler.resolver.resolveTypeAnnotation(element, node); 1846 return compiler.resolver.resolveTypeAnnotation(element, node);
1847 } 1847 }
1848 1848
1849 @override 1849 @override
1850 void ensureResolved(Element element) {
1851 if (compiler.serialization.isDeserialized(element)) {
1852 return;
1853 }
1854 computeWorldImpact(element);
1855 }
1856
1857 @override
1850 bool hasResolvedAst(Element element) { 1858 bool hasResolvedAst(Element element) {
1851 assert(invariant(element, element.isDeclaration, 1859 assert(invariant(element, element.isDeclaration,
1852 message: "Element $element must be the declaration.")); 1860 message: "Element $element must be the declaration."));
1853 if (compiler.serialization.isDeserialized(element)) { 1861 if (compiler.serialization.isDeserialized(element)) {
1854 return compiler.serialization.hasResolvedAst(element); 1862 return compiler.serialization.hasResolvedAst(element);
1855 } 1863 }
1856 return element is AstElement && 1864 return element is AstElement &&
1857 hasBeenResolved(element) && 1865 hasBeenResolved(element) &&
1858 element.hasResolvedAst; 1866 element.hasResolvedAst;
1859 } 1867 }
1860 1868
1861 @override 1869 @override
1862 ResolvedAst getResolvedAst(Element element) { 1870 ResolvedAst getResolvedAst(Element element) {
1863 assert(invariant(element, element.isDeclaration, 1871 assert(invariant(element, element.isDeclaration,
1864 message: "Element $element must be the declaration.")); 1872 message: "Element $element must be the declaration."));
1865 if (hasResolvedAst(element)) { 1873 if (hasResolvedAst(element)) {
1866 if (compiler.serialization.isDeserialized(element)) { 1874 if (compiler.serialization.isDeserialized(element)) {
1867 return compiler.serialization.getResolvedAst(element); 1875 return compiler.serialization.getResolvedAst(element);
1868 } 1876 }
1869 AstElement astElement = element; 1877 AstElement astElement = element;
1870 return astElement.resolvedAst; 1878 return astElement.resolvedAst;
1871 } 1879 }
1872 assert(invariant(element, hasResolvedAst(element), 1880 assert(invariant(element, hasResolvedAst(element),
1873 message: "ResolvedAst not available for $element.")); 1881 message: "ResolvedAst not available for $element."));
1874 return null; 1882 return null;
1875 } 1883 }
1876 1884
1877 @override 1885 @override
1886 ResolvedAst computeResolvedAst(Element element) {
1887 ensureResolved(element);
1888 return getResolvedAst(element);
1889 }
1890
1891 @override
1878 bool hasResolutionImpact(Element element) { 1892 bool hasResolutionImpact(Element element) {
1879 assert(invariant(element, element.isDeclaration, 1893 assert(invariant(element, element.isDeclaration,
1880 message: "Element $element must be the declaration.")); 1894 message: "Element $element must be the declaration."));
1881 if (compiler.serialization.isDeserialized(element)) { 1895 if (compiler.serialization.isDeserialized(element)) {
1882 return compiler.serialization.hasResolutionImpact(element); 1896 return compiler.serialization.hasResolutionImpact(element);
1883 } 1897 }
1884 return _resolutionImpactCache.containsKey(element); 1898 return _resolutionImpactCache.containsKey(element);
1885 } 1899 }
1886 1900
1887 @override 1901 @override
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2015 _ElementScanner(this.scanner); 2029 _ElementScanner(this.scanner);
2016 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2030 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2017 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2031 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2018 } 2032 }
2019 2033
2020 class _EmptyEnvironment implements Environment { 2034 class _EmptyEnvironment implements Environment {
2021 const _EmptyEnvironment(); 2035 const _EmptyEnvironment();
2022 2036
2023 String valueOf(String key) => null; 2037 String valueOf(String key) => null;
2024 } 2038 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | tests/compiler/dart2js/analyze_test_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698