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

Side by Side Diff: lib/src/checker/resolver.dart

Issue 1023543002: Enable inference in the core libs (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 | test/codegen/expect/dart/_interceptors.js » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Encapsulates how to invoke the analyzer resolver and overrides how it 5 /// Encapsulates how to invoke the analyzer resolver and overrides how it
6 /// computes types on expressions to use our restricted set of types. 6 /// computes types on expressions to use our restricted set of types.
7 library dev_compiler.src.checker.resolver; 7 library dev_compiler.src.checker.resolver;
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 /// overridden members in super classes. 116 /// overridden members in super classes.
117 class LibraryResolverWithInference extends LibraryResolver { 117 class LibraryResolverWithInference extends LibraryResolver {
118 final ResolverOptions _options; 118 final ResolverOptions _options;
119 119
120 LibraryResolverWithInference(context, this._options) : super(context); 120 LibraryResolverWithInference(context, this._options) : super(context);
121 121
122 @override 122 @override
123 void resolveReferencesAndTypes() { 123 void resolveReferencesAndTypes() {
124 _resolveVariableReferences(); 124 _resolveVariableReferences();
125 125
126 // Skip inference in the core libraries (note: resolvedLibraries are the
127 // libraries in the current strongly connected component).
128 if (resolvedLibraries.any((l) => l.librarySource.isInSystemLibrary)) {
129 _resolveReferencesAndTypes(false);
130 return;
131 }
132
133 // Run resolution in two stages, skipping method bodies first, so we can run 126 // Run resolution in two stages, skipping method bodies first, so we can run
134 // type-inference before we fully analyze methods. 127 // type-inference before we fully analyze methods.
135 _resolveReferencesAndTypes(true); 128 _resolveReferencesAndTypes(true);
136 _runInference(); 129 _runInference();
137 _resolveReferencesAndTypes(false); 130 _resolveReferencesAndTypes(false);
138 } 131 }
139 132
140 // Note: this was split from _resolveReferencesAndTypesInLibrary so we do it 133 // Note: this was split from _resolveReferencesAndTypesInLibrary so we do it
141 // only once. 134 // only once.
142 void _resolveVariableReferences() { 135 void _resolveVariableReferences() {
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } 515 }
523 } 516 }
524 517
525 // Review note: no longer need to override visitFunctionExpression, this is 518 // Review note: no longer need to override visitFunctionExpression, this is
526 // handled by the analyzer internally. 519 // handled by the analyzer internally.
527 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result? 520 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result?
528 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression 521 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression
529 // type in a (...) => expr or just the written type? 522 // type in a (...) => expr or just the written type?
530 523
531 } 524 }
OLDNEW
« no previous file with comments | « no previous file | test/codegen/expect/dart/_interceptors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698