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

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

Issue 1901683002: Support deserialization of ResolutionImpact for members of unnamed mixin applications (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 } 1865 }
1866 assert(invariant(element, hasResolvedAst(element), 1866 assert(invariant(element, hasResolvedAst(element),
1867 message: "ResolvedAst not available for $element.")); 1867 message: "ResolvedAst not available for $element."));
1868 return null; 1868 return null;
1869 } 1869 }
1870 1870
1871 @override 1871 @override
1872 bool hasResolutionImpact(Element element) { 1872 bool hasResolutionImpact(Element element) {
1873 assert(invariant(element, element.isDeclaration, 1873 assert(invariant(element, element.isDeclaration,
1874 message: "Element $element must be the declaration.")); 1874 message: "Element $element must be the declaration."));
1875 if (compiler.serialization.isDeserialized(element)) {
1876 return compiler.serialization.hasResolutionImpact(element);
1877 }
1875 return _resolutionImpactCache.containsKey(element); 1878 return _resolutionImpactCache.containsKey(element);
1876 } 1879 }
1877 1880
1878 @override 1881 @override
1879 ResolutionImpact getResolutionImpact(Element element) { 1882 ResolutionImpact getResolutionImpact(Element element) {
1880 assert(invariant(element, element.isDeclaration, 1883 assert(invariant(element, element.isDeclaration,
1881 message: "Element $element must be the declaration.")); 1884 message: "Element $element must be the declaration."));
1882 ResolutionImpact resolutionImpact = _resolutionImpactCache[element]; 1885 ResolutionImpact resolutionImpact;
1886 if (compiler.serialization.isDeserialized(element)) {
1887 resolutionImpact = compiler.serialization.getResolutionImpact(element);
1888 } else {
1889 resolutionImpact = _resolutionImpactCache[element];
1890 }
1883 assert(invariant(element, resolutionImpact != null, 1891 assert(invariant(element, resolutionImpact != null,
1884 message: "ResolutionImpact not available for $element.")); 1892 message: "ResolutionImpact not available for $element."));
1885 return resolutionImpact; 1893 return resolutionImpact;
1886 } 1894 }
1887 1895
1888 @override 1896 @override
1889 WorldImpact getWorldImpact(Element element) { 1897 WorldImpact getWorldImpact(Element element) {
1890 assert(invariant(element, element.isDeclaration, 1898 assert(invariant(element, element.isDeclaration,
1891 message: "Element $element must be the declaration.")); 1899 message: "Element $element must be the declaration."));
1892 WorldImpact worldImpact = _worldImpactCache[element]; 1900 WorldImpact worldImpact = _worldImpactCache[element];
1893 assert(invariant(element, worldImpact != null, 1901 assert(invariant(element, worldImpact != null,
1894 message: "WorldImpact not computed for $element.")); 1902 message: "WorldImpact not computed for $element."));
1895 return worldImpact; 1903 return worldImpact;
1896 } 1904 }
1897 1905
1898 @override 1906 @override
1899 WorldImpact computeWorldImpact(Element element) { 1907 WorldImpact computeWorldImpact(Element element) {
1900 assert(invariant(element, element.isDeclaration, 1908 assert(invariant(element, element.isDeclaration,
1901 message: "Element $element must be the declaration.")); 1909 message: "Element $element must be the declaration."));
1902 return _worldImpactCache.putIfAbsent(element, () { 1910 return _worldImpactCache.putIfAbsent(element, () {
1903 assert(compiler.parser != null); 1911 assert(compiler.parser != null);
1904 Node tree = compiler.parser.parse(element); 1912 Node tree = compiler.parser.parse(element);
1905 assert(invariant(element, !element.isSynthesized || tree == null)); 1913 assert(invariant(element, !element.isSynthesized || tree == null));
1906 ResolutionImpact resolutionImpact = compiler.resolver.resolve(element); 1914 ResolutionImpact resolutionImpact = compiler.resolver.resolve(element);
1915
1907 if (compiler.serialization.supportSerialization || 1916 if (compiler.serialization.supportSerialization ||
1908 retainCachesForTesting) { 1917 retainCachesForTesting) {
1909 // [ResolutionImpact] is currently only used by serialization. The 1918 // [ResolutionImpact] is currently only used by serialization. The
1910 // enqueuer uses the [WorldImpact] which is always cached. 1919 // enqueuer uses the [WorldImpact] which is always cached.
1911 // TODO(johnniwinther): Align these use cases better; maybe only 1920 // TODO(johnniwinther): Align these use cases better; maybe only
1912 // cache [ResolutionImpact] and let the enqueuer transform it into 1921 // cache [ResolutionImpact] and let the enqueuer transform it into
1913 // a [WorldImpact]. 1922 // a [WorldImpact].
1914 _resolutionImpactCache[element] = resolutionImpact; 1923 _resolutionImpactCache[element] = resolutionImpact;
1915 } 1924 }
1916 if (tree != null && !compiler.options.analyzeSignaturesOnly) { 1925 if (tree != null && !compiler.options.analyzeSignaturesOnly) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 _ElementScanner(this.scanner); 2037 _ElementScanner(this.scanner);
2029 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2038 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2030 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2039 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2031 } 2040 }
2032 2041
2033 class _EmptyEnvironment implements Environment { 2042 class _EmptyEnvironment implements Environment {
2034 const _EmptyEnvironment(); 2043 const _EmptyEnvironment();
2035 2044
2036 String valueOf(String key) => null; 2045 String valueOf(String key) => null;
2037 } 2046 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698