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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1329743005: Abstract over the type system. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 library analyzer.src.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 2349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 // 2360 //
2361 // Prepare inputs. 2361 // Prepare inputs.
2362 // 2362 //
2363 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); 2363 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT);
2364 List<UsedImportedElements> usedImportedElementsList = 2364 List<UsedImportedElements> usedImportedElementsList =
2365 getRequiredInput(USED_IMPORTED_ELEMENTS_INPUT); 2365 getRequiredInput(USED_IMPORTED_ELEMENTS_INPUT);
2366 List<UsedLocalElements> usedLocalElementsList = 2366 List<UsedLocalElements> usedLocalElementsList =
2367 getRequiredInput(USED_LOCAL_ELEMENTS_INPUT); 2367 getRequiredInput(USED_LOCAL_ELEMENTS_INPUT);
2368 CompilationUnitElement unitElement = unit.element; 2368 CompilationUnitElement unitElement = unit.element;
2369 LibraryElement libraryElement = unitElement.library; 2369 LibraryElement libraryElement = unitElement.library;
2370 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
2370 // 2371 //
2371 // Generate errors. 2372 // Generate errors.
2372 // 2373 //
2373 unit.accept(new DeadCodeVerifier(errorReporter)); 2374 unit.accept(new DeadCodeVerifier(errorReporter, new TypeSystemImpl(typeProvi der)));
2374 // Verify imports. 2375 // Verify imports.
2375 { 2376 {
2376 ImportsVerifier verifier = new ImportsVerifier(); 2377 ImportsVerifier verifier = new ImportsVerifier();
2377 verifier.addImports(unit); 2378 verifier.addImports(unit);
2378 usedImportedElementsList.forEach(verifier.removeUsedElements); 2379 usedImportedElementsList.forEach(verifier.removeUsedElements);
2379 verifier.generateDuplicateImportHints(errorReporter); 2380 verifier.generateDuplicateImportHints(errorReporter);
2380 verifier.generateUnusedImportHints(errorReporter); 2381 verifier.generateUnusedImportHints(errorReporter);
2381 } 2382 }
2382 // Unused local elements. 2383 // Unused local elements.
2383 { 2384 {
2384 UsedLocalElements usedElements = 2385 UsedLocalElements usedElements =
2385 new UsedLocalElements.merge(usedLocalElementsList); 2386 new UsedLocalElements.merge(usedLocalElementsList);
2386 UnusedLocalElementsVerifier visitor = 2387 UnusedLocalElementsVerifier visitor =
2387 new UnusedLocalElementsVerifier(errorListener, usedElements); 2388 new UnusedLocalElementsVerifier(errorListener, usedElements);
2388 unitElement.accept(visitor); 2389 unitElement.accept(visitor);
2389 } 2390 }
2390 // Dart2js analysis. 2391 // Dart2js analysis.
2391 if (analysisOptions.dart2jsHint) { 2392 if (analysisOptions.dart2jsHint) {
2392 unit.accept(new Dart2JSVerifier(errorReporter)); 2393 unit.accept(new Dart2JSVerifier(errorReporter));
2393 } 2394 }
2394 // Dart best practices. 2395 // Dart best practices.
2395 InheritanceManager inheritanceManager = 2396 InheritanceManager inheritanceManager =
2396 new InheritanceManager(libraryElement); 2397 new InheritanceManager(libraryElement);
2397 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); 2398 unit.accept(new BestPracticesVerifier(errorReporter, typeProvider, new TypeS ystemImpl(typeProvider)));
2398 unit.accept(new BestPracticesVerifier(errorReporter, typeProvider));
2399 unit.accept(new OverrideVerifier(errorReporter, inheritanceManager)); 2399 unit.accept(new OverrideVerifier(errorReporter, inheritanceManager));
2400 // Find to-do comments. 2400 // Find to-do comments.
2401 new ToDoFinder(errorReporter).findIn(unit); 2401 new ToDoFinder(errorReporter).findIn(unit);
2402 // 2402 //
2403 // Record outputs. 2403 // Record outputs.
2404 // 2404 //
2405 outputs[HINTS] = errorListener.errors; 2405 outputs[HINTS] = errorListener.errors;
2406 } 2406 }
2407 2407
2408 /** 2408 /**
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
3924 CompilationUnitElement unitElement = unit.element; 3924 CompilationUnitElement unitElement = unit.element;
3925 LibraryElement libraryElement = unitElement.library; 3925 LibraryElement libraryElement = unitElement.library;
3926 // 3926 //
3927 // Validate the directives. 3927 // Validate the directives.
3928 // 3928 //
3929 validateDirectives(unit); 3929 validateDirectives(unit);
3930 // 3930 //
3931 // Use the ConstantVerifier to compute errors. 3931 // Use the ConstantVerifier to compute errors.
3932 // 3932 //
3933 ConstantVerifier constantVerifier = new ConstantVerifier( 3933 ConstantVerifier constantVerifier = new ConstantVerifier(
3934 errorReporter, libraryElement, typeProvider, context.declaredVariables); 3934 errorReporter, libraryElement, typeProvider, new TypeSystemImpl(typeProv ider), context.declaredVariables);
3935 unit.accept(constantVerifier); 3935 unit.accept(constantVerifier);
3936 // 3936 //
3937 // Use the ErrorVerifier to compute errors. 3937 // Use the ErrorVerifier to compute errors.
3938 // 3938 //
3939 ErrorVerifier errorVerifier = new ErrorVerifier( 3939 ErrorVerifier errorVerifier = new ErrorVerifier(
3940 errorReporter, 3940 errorReporter,
3941 libraryElement, 3941 libraryElement,
3942 typeProvider, 3942 typeProvider,
3943 new TypeSystemImpl(typeProvider),
3943 new InheritanceManager(libraryElement), 3944 new InheritanceManager(libraryElement),
3944 context.analysisOptions.enableSuperMixins); 3945 context.analysisOptions.enableSuperMixins);
3945 unit.accept(errorVerifier); 3946 unit.accept(errorVerifier);
3946 // 3947 //
3947 // Record outputs. 3948 // Record outputs.
3948 // 3949 //
3949 outputs[VERIFY_ERRORS] = removeDuplicateErrors(errorListener.errors); 3950 outputs[VERIFY_ERRORS] = removeDuplicateErrors(errorListener.errors);
3950 } 3951 }
3951 3952
3952 /** 3953 /**
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4124 4125
4125 @override 4126 @override
4126 bool moveNext() { 4127 bool moveNext() {
4127 if (_newSources.isEmpty) { 4128 if (_newSources.isEmpty) {
4128 return false; 4129 return false;
4129 } 4130 }
4130 currentTarget = _newSources.removeLast(); 4131 currentTarget = _newSources.removeLast();
4131 return true; 4132 return true;
4132 } 4133 }
4133 } 4134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698