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