| OLD | NEW |
| 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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 void internalPerform() { | 1508 void internalPerform() { |
| 1509 // | 1509 // |
| 1510 // Prepare inputs. | 1510 // Prepare inputs. |
| 1511 // | 1511 // |
| 1512 // Note: UNIT_INPUT is not needed. It is merely a bookkeeping dependency | 1512 // Note: UNIT_INPUT is not needed. It is merely a bookkeeping dependency |
| 1513 // to ensure that resolution has occurred before we attempt to determine | 1513 // to ensure that resolution has occurred before we attempt to determine |
| 1514 // constant dependencies. | 1514 // constant dependencies. |
| 1515 // | 1515 // |
| 1516 ConstantEvaluationTarget constant = target; | 1516 ConstantEvaluationTarget constant = target; |
| 1517 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 1517 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 1518 TypeSystem typeSystem = context.typeSystem; | |
| 1519 // | 1518 // |
| 1520 // Compute dependencies. | 1519 // Compute dependencies. |
| 1521 // | 1520 // |
| 1522 List<ConstantEvaluationTarget> dependencies = <ConstantEvaluationTarget>[]; | 1521 List<ConstantEvaluationTarget> dependencies = <ConstantEvaluationTarget>[]; |
| 1523 new ConstantEvaluationEngine( | 1522 new ConstantEvaluationEngine(typeProvider, context.declaredVariables, |
| 1524 typeProvider, typeSystem, context.declaredVariables) | 1523 typeSystem: context.typeSystem) |
| 1525 .computeDependencies(constant, dependencies.add); | 1524 .computeDependencies(constant, dependencies.add); |
| 1526 // | 1525 // |
| 1527 // Record outputs. | 1526 // Record outputs. |
| 1528 // | 1527 // |
| 1529 outputs[CONSTANT_DEPENDENCIES] = dependencies; | 1528 outputs[CONSTANT_DEPENDENCIES] = dependencies; |
| 1530 } | 1529 } |
| 1531 | 1530 |
| 1532 /** | 1531 /** |
| 1533 * Return a map from the names of the inputs of this kind of task to the task | 1532 * Return a map from the names of the inputs of this kind of task to the task |
| 1534 * input descriptors describing those inputs for a task with the | 1533 * input descriptors describing those inputs for a task with the |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 void internalPerform() { | 1599 void internalPerform() { |
| 1601 // | 1600 // |
| 1602 // Prepare inputs. | 1601 // Prepare inputs. |
| 1603 // | 1602 // |
| 1604 // Note: DEPENDENCIES_INPUT is not needed. It is merely a bookkeeping | 1603 // Note: DEPENDENCIES_INPUT is not needed. It is merely a bookkeeping |
| 1605 // dependency to ensure that the constants that this constant depends on | 1604 // dependency to ensure that the constants that this constant depends on |
| 1606 // are computed first. | 1605 // are computed first. |
| 1607 ConstantEvaluationTarget constant = target; | 1606 ConstantEvaluationTarget constant = target; |
| 1608 AnalysisContext context = constant.context; | 1607 AnalysisContext context = constant.context; |
| 1609 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 1608 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 1610 TypeSystem typeSystem = context.typeSystem; | |
| 1611 // | 1609 // |
| 1612 // Compute the value of the constant, or report an error if there was a | 1610 // Compute the value of the constant, or report an error if there was a |
| 1613 // cycle. | 1611 // cycle. |
| 1614 // | 1612 // |
| 1615 ConstantEvaluationEngine constantEvaluationEngine = | 1613 ConstantEvaluationEngine constantEvaluationEngine = |
| 1616 new ConstantEvaluationEngine( | 1614 new ConstantEvaluationEngine(typeProvider, context.declaredVariables, |
| 1617 typeProvider, typeSystem, context.declaredVariables); | 1615 typeSystem: context.typeSystem); |
| 1618 if (dependencyCycle == null) { | 1616 if (dependencyCycle == null) { |
| 1619 constantEvaluationEngine.computeConstantValue(constant); | 1617 constantEvaluationEngine.computeConstantValue(constant); |
| 1620 } else { | 1618 } else { |
| 1621 List<ConstantEvaluationTarget> constantsInCycle = | 1619 List<ConstantEvaluationTarget> constantsInCycle = |
| 1622 <ConstantEvaluationTarget>[]; | 1620 <ConstantEvaluationTarget>[]; |
| 1623 for (WorkItem workItem in dependencyCycle) { | 1621 for (WorkItem workItem in dependencyCycle) { |
| 1624 if (workItem.descriptor == DESCRIPTOR) { | 1622 if (workItem.descriptor == DESCRIPTOR) { |
| 1625 constantsInCycle.add(workItem.target); | 1623 constantsInCycle.add(workItem.target); |
| 1626 } | 1624 } |
| 1627 } | 1625 } |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2344 getRequiredInput(USED_IMPORTED_ELEMENTS_INPUT); | 2342 getRequiredInput(USED_IMPORTED_ELEMENTS_INPUT); |
| 2345 List<UsedLocalElements> usedLocalElementsList = | 2343 List<UsedLocalElements> usedLocalElementsList = |
| 2346 getRequiredInput(USED_LOCAL_ELEMENTS_INPUT); | 2344 getRequiredInput(USED_LOCAL_ELEMENTS_INPUT); |
| 2347 CompilationUnitElement unitElement = unit.element; | 2345 CompilationUnitElement unitElement = unit.element; |
| 2348 LibraryElement libraryElement = unitElement.library; | 2346 LibraryElement libraryElement = unitElement.library; |
| 2349 TypeSystem typeSystem = context.typeSystem; | 2347 TypeSystem typeSystem = context.typeSystem; |
| 2350 | 2348 |
| 2351 // | 2349 // |
| 2352 // Generate errors. | 2350 // Generate errors. |
| 2353 // | 2351 // |
| 2354 unit.accept(new DeadCodeVerifier(errorReporter, typeSystem)); | 2352 unit.accept(new DeadCodeVerifier(errorReporter, typeSystem: typeSystem)); |
| 2355 // Verify imports. | 2353 // Verify imports. |
| 2356 { | 2354 { |
| 2357 ImportsVerifier verifier = new ImportsVerifier(); | 2355 ImportsVerifier verifier = new ImportsVerifier(); |
| 2358 verifier.addImports(unit); | 2356 verifier.addImports(unit); |
| 2359 usedImportedElementsList.forEach(verifier.removeUsedElements); | 2357 usedImportedElementsList.forEach(verifier.removeUsedElements); |
| 2360 verifier.generateDuplicateImportHints(errorReporter); | 2358 verifier.generateDuplicateImportHints(errorReporter); |
| 2361 verifier.generateUnusedImportHints(errorReporter); | 2359 verifier.generateUnusedImportHints(errorReporter); |
| 2362 } | 2360 } |
| 2363 // Unused local elements. | 2361 // Unused local elements. |
| 2364 { | 2362 { |
| 2365 UsedLocalElements usedElements = | 2363 UsedLocalElements usedElements = |
| 2366 new UsedLocalElements.merge(usedLocalElementsList); | 2364 new UsedLocalElements.merge(usedLocalElementsList); |
| 2367 UnusedLocalElementsVerifier visitor = | 2365 UnusedLocalElementsVerifier visitor = |
| 2368 new UnusedLocalElementsVerifier(errorListener, usedElements); | 2366 new UnusedLocalElementsVerifier(errorListener, usedElements); |
| 2369 unitElement.accept(visitor); | 2367 unitElement.accept(visitor); |
| 2370 } | 2368 } |
| 2371 // Dart2js analysis. | 2369 // Dart2js analysis. |
| 2372 if (analysisOptions.dart2jsHint) { | 2370 if (analysisOptions.dart2jsHint) { |
| 2373 unit.accept(new Dart2JSVerifier(errorReporter)); | 2371 unit.accept(new Dart2JSVerifier(errorReporter)); |
| 2374 } | 2372 } |
| 2375 // Dart best practices. | 2373 // Dart best practices. |
| 2376 InheritanceManager inheritanceManager = | 2374 InheritanceManager inheritanceManager = |
| 2377 new InheritanceManager(libraryElement); | 2375 new InheritanceManager(libraryElement); |
| 2378 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 2376 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 2379 | 2377 |
| 2380 unit.accept( | 2378 unit.accept(new BestPracticesVerifier(errorReporter, typeProvider, |
| 2381 new BestPracticesVerifier(errorReporter, typeProvider, typeSystem)); | 2379 typeSystem: typeSystem)); |
| 2382 unit.accept(new OverrideVerifier(errorReporter, inheritanceManager)); | 2380 unit.accept(new OverrideVerifier(errorReporter, inheritanceManager)); |
| 2383 // Find to-do comments. | 2381 // Find to-do comments. |
| 2384 new ToDoFinder(errorReporter).findIn(unit); | 2382 new ToDoFinder(errorReporter).findIn(unit); |
| 2385 // | 2383 // |
| 2386 // Record outputs. | 2384 // Record outputs. |
| 2387 // | 2385 // |
| 2388 outputs[HINTS] = errorListener.errors; | 2386 outputs[HINTS] = errorListener.errors; |
| 2389 } | 2387 } |
| 2390 | 2388 |
| 2391 /** | 2389 /** |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 @override | 2454 @override |
| 2457 TaskDescriptor get descriptor => DESCRIPTOR; | 2455 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2458 | 2456 |
| 2459 @override | 2457 @override |
| 2460 void internalPerform() { | 2458 void internalPerform() { |
| 2461 // | 2459 // |
| 2462 // Prepare inputs. | 2460 // Prepare inputs. |
| 2463 // | 2461 // |
| 2464 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 2462 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 2465 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 2463 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 2466 TypeSystem typeSystem = context.typeSystem; | |
| 2467 // | 2464 // |
| 2468 // Infer instance members. | 2465 // Infer instance members. |
| 2469 // | 2466 // |
| 2470 if (context.analysisOptions.strongMode) { | 2467 if (context.analysisOptions.strongMode) { |
| 2471 InstanceMemberInferrer inferrer = | 2468 InstanceMemberInferrer inferrer = new InstanceMemberInferrer(typeProvider, |
| 2472 new InstanceMemberInferrer(typeProvider, typeSystem); | 2469 typeSystem: context.typeSystem); |
| 2473 inferrer.inferCompilationUnit(unit.element); | 2470 inferrer.inferCompilationUnit(unit.element); |
| 2474 } | 2471 } |
| 2475 // | 2472 // |
| 2476 // Record outputs. | 2473 // Record outputs. |
| 2477 // | 2474 // |
| 2478 outputs[RESOLVED_UNIT7] = unit; | 2475 outputs[RESOLVED_UNIT7] = unit; |
| 2479 } | 2476 } |
| 2480 | 2477 |
| 2481 /** | 2478 /** |
| 2482 * Return a map from the names of the inputs of this kind of task to the task | 2479 * Return a map from the names of the inputs of this kind of task to the task |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2665 // | 2662 // |
| 2666 // Prepare inputs. | 2663 // Prepare inputs. |
| 2667 // | 2664 // |
| 2668 // Note: DEPENDENCIES_INPUT is not needed. It is merely a bookkeeping | 2665 // Note: DEPENDENCIES_INPUT is not needed. It is merely a bookkeeping |
| 2669 // dependency to ensure that the variables that this variable references | 2666 // dependency to ensure that the variables that this variable references |
| 2670 // have types inferred before inferring the type of this variable. | 2667 // have types inferred before inferring the type of this variable. |
| 2671 // | 2668 // |
| 2672 VariableElementImpl variable = target; | 2669 VariableElementImpl variable = target; |
| 2673 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 2670 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 2674 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 2671 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 2675 TypeSystem typeSystem = context.typeSystem; | |
| 2676 RecordingErrorListener errorListener = new RecordingErrorListener(); | 2672 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 2677 if (dependencyCycle == null) { | 2673 if (dependencyCycle == null) { |
| 2678 // | 2674 // |
| 2679 // Re-resolve the variable's initializer so that the inferred types of oth
er | 2675 // Re-resolve the variable's initializer so that the inferred types of oth
er |
| 2680 // variables will be propagated. | 2676 // variables will be propagated. |
| 2681 // | 2677 // |
| 2682 NodeLocator locator = new NodeLocator(variable.nameOffset); | 2678 NodeLocator locator = new NodeLocator(variable.nameOffset); |
| 2683 AstNode node = locator.searchWithin(unit); | 2679 AstNode node = locator.searchWithin(unit); |
| 2684 VariableDeclaration declaration = node | 2680 VariableDeclaration declaration = node |
| 2685 .getAncestor((AstNode ancestor) => ancestor is VariableDeclaration); | 2681 .getAncestor((AstNode ancestor) => ancestor is VariableDeclaration); |
| 2686 if (declaration == null || declaration.name != node) { | 2682 if (declaration == null || declaration.name != node) { |
| 2687 throw new AnalysisException( | 2683 throw new AnalysisException( |
| 2688 "NodeLocator failed to find a variable's declaration"); | 2684 "NodeLocator failed to find a variable's declaration"); |
| 2689 } | 2685 } |
| 2690 Expression initializer = declaration.initializer; | 2686 Expression initializer = declaration.initializer; |
| 2691 ResolutionEraser.erase(initializer, eraseDeclarations: false); | 2687 ResolutionEraser.erase(initializer, eraseDeclarations: false); |
| 2692 ResolutionContext resolutionContext = | 2688 ResolutionContext resolutionContext = |
| 2693 ResolutionContextBuilder.contextFor(initializer, errorListener); | 2689 ResolutionContextBuilder.contextFor(initializer, errorListener); |
| 2694 ResolverVisitor visitor = new ResolverVisitor(variable.library, | 2690 ResolverVisitor visitor = new ResolverVisitor( |
| 2695 variable.source, typeProvider, typeSystem, errorListener, | 2691 variable.library, variable.source, typeProvider, errorListener, |
| 2696 nameScope: resolutionContext.scope); | 2692 nameScope: resolutionContext.scope); |
| 2697 if (resolutionContext.enclosingClassDeclaration != null) { | 2693 if (resolutionContext.enclosingClassDeclaration != null) { |
| 2698 visitor.prepareToResolveMembersInClass( | 2694 visitor.prepareToResolveMembersInClass( |
| 2699 resolutionContext.enclosingClassDeclaration); | 2695 resolutionContext.enclosingClassDeclaration); |
| 2700 } | 2696 } |
| 2701 visitor.initForIncrementalResolution(); | 2697 visitor.initForIncrementalResolution(); |
| 2702 initializer.accept(visitor); | 2698 initializer.accept(visitor); |
| 2703 // | 2699 // |
| 2704 // Record the type of the variable. | 2700 // Record the type of the variable. |
| 2705 // | 2701 // |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3144 @override | 3140 @override |
| 3145 void internalPerform() { | 3141 void internalPerform() { |
| 3146 RecordingErrorListener errorListener = new RecordingErrorListener(); | 3142 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 3147 // | 3143 // |
| 3148 // Prepare inputs. | 3144 // Prepare inputs. |
| 3149 // | 3145 // |
| 3150 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT); | 3146 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT); |
| 3151 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 3147 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3152 CompilationUnitElement unitElement = unit.element; | 3148 CompilationUnitElement unitElement = unit.element; |
| 3153 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 3149 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 3154 TypeSystem typeSystem = context.typeSystem; | |
| 3155 // | 3150 // |
| 3156 // Resolve references. | 3151 // Resolve references. |
| 3157 // | 3152 // |
| 3158 InheritanceManager inheritanceManager = | 3153 InheritanceManager inheritanceManager = |
| 3159 new InheritanceManager(libraryElement); | 3154 new InheritanceManager(libraryElement); |
| 3160 PartialResolverVisitor visitor = new PartialResolverVisitor(libraryElement, | 3155 PartialResolverVisitor visitor = new PartialResolverVisitor( |
| 3161 unitElement.source, typeProvider, typeSystem, errorListener, | 3156 libraryElement, unitElement.source, typeProvider, errorListener, |
| 3162 inheritanceManager: inheritanceManager); | 3157 inheritanceManager: inheritanceManager); |
| 3163 unit.accept(visitor); | 3158 unit.accept(visitor); |
| 3164 // | 3159 // |
| 3165 // Record outputs. | 3160 // Record outputs. |
| 3166 // | 3161 // |
| 3167 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables; | 3162 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables; |
| 3168 outputs[PARTIALLY_RESOLVE_REFERENCES_ERRORS] = | 3163 outputs[PARTIALLY_RESOLVE_REFERENCES_ERRORS] = |
| 3169 removeDuplicateErrors(errorListener.errors); | 3164 removeDuplicateErrors(errorListener.errors); |
| 3170 outputs[RESOLVED_UNIT5] = unit; | 3165 outputs[RESOLVED_UNIT5] = unit; |
| 3171 } | 3166 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3367 // | 3362 // |
| 3368 // Prepare inputs. | 3363 // Prepare inputs. |
| 3369 // | 3364 // |
| 3370 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 3365 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3371 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 3366 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 3372 // | 3367 // |
| 3373 // Resolve function bodies. | 3368 // Resolve function bodies. |
| 3374 // | 3369 // |
| 3375 CompilationUnitElement unitElement = unit.element; | 3370 CompilationUnitElement unitElement = unit.element; |
| 3376 RecordingErrorListener errorListener = new RecordingErrorListener(); | 3371 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 3377 TypeSystem typeSystem = context.typeSystem; | |
| 3378 for (CompilationUnitMember unitMember in unit.declarations) { | 3372 for (CompilationUnitMember unitMember in unit.declarations) { |
| 3379 if (unitMember is FunctionDeclaration) { | 3373 if (unitMember is FunctionDeclaration) { |
| 3380 _resolveFunctionBody(unitMember.functionExpression.body, unitElement, | 3374 _resolveFunctionBody(unitMember.functionExpression.body, unitElement, |
| 3381 typeProvider, typeSystem, errorListener); | 3375 typeProvider, errorListener); |
| 3382 } else if (unitMember is ClassDeclaration) { | 3376 } else if (unitMember is ClassDeclaration) { |
| 3383 for (ClassMember classMember in unitMember.members) { | 3377 for (ClassMember classMember in unitMember.members) { |
| 3384 if (classMember is ConstructorDeclaration) { | 3378 if (classMember is ConstructorDeclaration) { |
| 3385 _resolveFunctionBody(classMember.body, unitElement, typeProvider, | 3379 _resolveFunctionBody( |
| 3386 typeSystem, errorListener); | 3380 classMember.body, unitElement, typeProvider, errorListener); |
| 3387 } else if (classMember is MethodDeclaration) { | 3381 } else if (classMember is MethodDeclaration) { |
| 3388 _resolveFunctionBody(classMember.body, unitElement, typeProvider, | 3382 _resolveFunctionBody( |
| 3389 typeSystem, errorListener); | 3383 classMember.body, unitElement, typeProvider, errorListener); |
| 3390 } | 3384 } |
| 3391 } | 3385 } |
| 3392 } | 3386 } |
| 3393 } | 3387 } |
| 3394 // | 3388 // |
| 3395 // Record outputs. | 3389 // Record outputs. |
| 3396 // | 3390 // |
| 3397 outputs[RESOLVE_FUNCTION_BODIES_ERRORS] = errorListener.errors; | 3391 outputs[RESOLVE_FUNCTION_BODIES_ERRORS] = errorListener.errors; |
| 3398 outputs[RESOLVED_UNIT8] = unit; | 3392 outputs[RESOLVED_UNIT8] = unit; |
| 3399 } | 3393 } |
| 3400 | 3394 |
| 3401 void _resolveFunctionBody( | 3395 void _resolveFunctionBody( |
| 3402 FunctionBody functionBody, | 3396 FunctionBody functionBody, |
| 3403 CompilationUnitElement unitElement, | 3397 CompilationUnitElement unitElement, |
| 3404 TypeProvider typeProvider, | 3398 TypeProvider typeProvider, |
| 3405 TypeSystem typeSystem, | |
| 3406 RecordingErrorListener errorListener) { | 3399 RecordingErrorListener errorListener) { |
| 3407 ResolutionContext resolutionContext = | 3400 ResolutionContext resolutionContext = |
| 3408 ResolutionContextBuilder.contextFor(functionBody, errorListener); | 3401 ResolutionContextBuilder.contextFor(functionBody, errorListener); |
| 3409 ResolverVisitor visitor = new ResolverVisitor(unitElement.library, | 3402 ResolverVisitor visitor = new ResolverVisitor( |
| 3410 unitElement.source, typeProvider, typeSystem, errorListener, | 3403 unitElement.library, unitElement.source, typeProvider, errorListener, |
| 3411 nameScope: resolutionContext.scope); | 3404 nameScope: resolutionContext.scope); |
| 3412 if (resolutionContext.enclosingClassDeclaration != null) { | 3405 if (resolutionContext.enclosingClassDeclaration != null) { |
| 3413 visitor.prepareToResolveMembersInClass( | 3406 visitor.prepareToResolveMembersInClass( |
| 3414 resolutionContext.enclosingClassDeclaration); | 3407 resolutionContext.enclosingClassDeclaration); |
| 3415 } | 3408 } |
| 3416 Declaration declaration = functionBody.getAncestor((AstNode node) => | 3409 Declaration declaration = functionBody.getAncestor((AstNode node) => |
| 3417 node is ConstructorDeclaration || | 3410 node is ConstructorDeclaration || |
| 3418 node is FunctionDeclaration || | 3411 node is FunctionDeclaration || |
| 3419 node is MethodDeclaration); | 3412 node is MethodDeclaration); |
| 3420 visitor.initForIncrementalResolution(declaration); | 3413 visitor.initForIncrementalResolution(declaration); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3901 RecordingErrorListener errorListener = new RecordingErrorListener(); | 3894 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 3902 Source source = getRequiredSource(); | 3895 Source source = getRequiredSource(); |
| 3903 errorReporter = new ErrorReporter(errorListener, source); | 3896 errorReporter = new ErrorReporter(errorListener, source); |
| 3904 // | 3897 // |
| 3905 // Prepare inputs. | 3898 // Prepare inputs. |
| 3906 // | 3899 // |
| 3907 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 3900 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 3908 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 3901 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3909 CompilationUnitElement unitElement = unit.element; | 3902 CompilationUnitElement unitElement = unit.element; |
| 3910 LibraryElement libraryElement = unitElement.library; | 3903 LibraryElement libraryElement = unitElement.library; |
| 3911 TypeSystem typeSystem = context.typeSystem; | |
| 3912 // | 3904 // |
| 3913 // Validate the directives. | 3905 // Validate the directives. |
| 3914 // | 3906 // |
| 3915 validateDirectives(unit); | 3907 validateDirectives(unit); |
| 3916 // | 3908 // |
| 3917 // Use the ConstantVerifier to compute errors. | 3909 // Use the ConstantVerifier to compute errors. |
| 3918 // | 3910 // |
| 3919 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, | 3911 ConstantVerifier constantVerifier = new ConstantVerifier( |
| 3920 libraryElement, typeProvider, typeSystem, context.declaredVariables); | 3912 errorReporter, libraryElement, typeProvider, context.declaredVariables); |
| 3921 unit.accept(constantVerifier); | 3913 unit.accept(constantVerifier); |
| 3922 // | 3914 // |
| 3923 // Use the ErrorVerifier to compute errors. | 3915 // Use the ErrorVerifier to compute errors. |
| 3924 // | 3916 // |
| 3925 ErrorVerifier errorVerifier = new ErrorVerifier( | 3917 ErrorVerifier errorVerifier = new ErrorVerifier( |
| 3926 errorReporter, | 3918 errorReporter, |
| 3927 libraryElement, | 3919 libraryElement, |
| 3928 typeProvider, | 3920 typeProvider, |
| 3929 typeSystem, | |
| 3930 new InheritanceManager(libraryElement), | 3921 new InheritanceManager(libraryElement), |
| 3931 context.analysisOptions.enableSuperMixins); | 3922 context.analysisOptions.enableSuperMixins); |
| 3932 unit.accept(errorVerifier); | 3923 unit.accept(errorVerifier); |
| 3933 // | 3924 // |
| 3934 // Record outputs. | 3925 // Record outputs. |
| 3935 // | 3926 // |
| 3936 outputs[VERIFY_ERRORS] = removeDuplicateErrors(errorListener.errors); | 3927 outputs[VERIFY_ERRORS] = removeDuplicateErrors(errorListener.errors); |
| 3937 } | 3928 } |
| 3938 | 3929 |
| 3939 /** | 3930 /** |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4111 | 4102 |
| 4112 @override | 4103 @override |
| 4113 bool moveNext() { | 4104 bool moveNext() { |
| 4114 if (_newSources.isEmpty) { | 4105 if (_newSources.isEmpty) { |
| 4115 return false; | 4106 return false; |
| 4116 } | 4107 } |
| 4117 currentTarget = _newSources.removeLast(); | 4108 currentTarget = _newSources.removeLast(); |
| 4118 return true; | 4109 return true; |
| 4119 } | 4110 } |
| 4120 } | 4111 } |
| OLD | NEW |