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

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

Issue 1228063003: fix for 1.12.0-dev SDK and 0.25.1 analyzer breaking changes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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) 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 visitors.values.forEach((v) => v.skipMethodBodies = false); 43 visitors.values.forEach((v) => v.skipMethodBodies = false);
44 _resolveEverything(visitors); 44 _resolveEverything(visitors);
45 } 45 }
46 46
47 // Note: this was split from _resolveReferencesAndTypesInLibrary so we do it 47 // Note: this was split from _resolveReferencesAndTypesInLibrary so we do it
48 // only once. 48 // only once.
49 void _resolveVariableReferences() { 49 void _resolveVariableReferences() {
50 for (Library library in resolvedLibraries) { 50 for (Library library in resolvedLibraries) {
51 for (Source source in library.compilationUnitSources) { 51 for (Source source in library.compilationUnitSources) {
52 library.getAST(source).accept( 52 library.getAST(source).accept(new VariableResolverVisitor(
53 new VariableResolverVisitor.con1(library, source, typeProvider)); 53 library.libraryElement, source, typeProvider, library.errorListener,
54 nameScope: library.libraryScope));
54 } 55 }
55 } 56 }
56 } 57 }
57 58
58 // Note: this was split from _resolveReferencesAndTypesInLibrary so we can do 59 // Note: this was split from _resolveReferencesAndTypesInLibrary so we can do
59 // resolution in pieces. 60 // resolution in pieces.
60 Map<Source, RestrictedResolverVisitor> _createVisitors() { 61 Map<Source, RestrictedResolverVisitor> _createVisitors() {
61 var visitors = <Source, RestrictedResolverVisitor>{}; 62 var visitors = <Source, RestrictedResolverVisitor>{};
62 for (Library library in resolvedLibraries) { 63 for (Library library in resolvedLibraries) {
63 for (Source source in library.compilationUnitSources) { 64 for (Source source in library.compilationUnitSources) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 bool _revisiting = false; 352 bool _revisiting = false;
352 353
353 /// Initializers that have been visited, reanalyzed, and for which no node was 354 /// Initializers that have been visited, reanalyzed, and for which no node was
354 /// internally skipped. These initializers are fully resolved and don't need 355 /// internally skipped. These initializers are fully resolved and don't need
355 /// to be re-resolved on a sunsequent pass. 356 /// to be re-resolved on a sunsequent pass.
356 final _visitedInitializers = new Set<VariableDeclaration>(); 357 final _visitedInitializers = new Set<VariableDeclaration>();
357 358
358 RestrictedResolverVisitor(Library library, Source source, 359 RestrictedResolverVisitor(Library library, Source source,
359 TypeProvider typeProvider, StrongModeOptions options) 360 TypeProvider typeProvider, StrongModeOptions options)
360 : _typeProvider = typeProvider, 361 : _typeProvider = typeProvider,
361 super.con1(library, source, typeProvider, 362 super(
363 library.libraryElement, source, typeProvider, library.errorListener,
364 nameScope: library.libraryScope,
365 inheritanceManager: library.inheritanceManager,
362 typeAnalyzerFactory: RestrictedStaticTypeAnalyzer.constructor); 366 typeAnalyzerFactory: RestrictedStaticTypeAnalyzer.constructor);
363 367
364 reanalyzeInitializer(VariableDeclaration variable) { 368 reanalyzeInitializer(VariableDeclaration variable) {
365 try { 369 try {
366 _revisiting = true; 370 _revisiting = true;
367 _nodeWasSkipped = false; 371 _nodeWasSkipped = false;
368 var node = variable.parent.parent; 372 var node = variable.parent.parent;
369 var oldState; 373 var oldState;
370 var state = _stateAtDeclaration[node]; 374 var state = _stateAtDeclaration[node];
371 if (state != null) { 375 if (state != null) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 690 }
687 } 691 }
688 692
689 // Review note: no longer need to override visitFunctionExpression, this is 693 // Review note: no longer need to override visitFunctionExpression, this is
690 // handled by the analyzer internally. 694 // handled by the analyzer internally.
691 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result? 695 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result?
692 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression 696 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression
693 // type in a (...) => expr or just the written type? 697 // type in a (...) => expr or just the written type?
694 698
695 } 699 }
OLDNEW
« no previous file with comments | « .gitignore ('k') | lib/src/codegen/ast_builder.dart » ('j') | lib/src/codegen/ast_builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698