| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 * | 331 * |
| 332 * The list will be empty if there were no errors, but will not be `null`. | 332 * The list will be empty if there were no errors, but will not be `null`. |
| 333 * | 333 * |
| 334 * The result is only available for [Source]s representing a compilation unit. | 334 * The result is only available for [Source]s representing a compilation unit. |
| 335 */ | 335 */ |
| 336 final ListResultDescriptor<AnalysisError> PARSE_ERRORS = | 336 final ListResultDescriptor<AnalysisError> PARSE_ERRORS = |
| 337 new ListResultDescriptor<AnalysisError>( | 337 new ListResultDescriptor<AnalysisError>( |
| 338 'PARSE_ERRORS', AnalysisError.NO_ERRORS); | 338 'PARSE_ERRORS', AnalysisError.NO_ERRORS); |
| 339 | 339 |
| 340 /** | 340 /** |
| 341 * A list of the [VariableElement]s whose type should be known to propagate |
| 342 * the type of another variable (the target). |
| 343 * |
| 344 * The result is only available for [VariableElement]s. |
| 345 */ |
| 346 final ListResultDescriptor<VariableElement> PROPAGABLE_VARIABLE_DEPENDENCIES = |
| 347 new ListResultDescriptor<VariableElement>( |
| 348 'PROPAGABLE_VARIABLE_DEPENDENCIES', null); |
| 349 |
| 350 /** |
| 351 * A list of the [VariableElement]s defined in a unit whose type might be |
| 352 * propagated. This includes variables defined at the library level as well as |
| 353 * static and instance members inside classes. |
| 354 * |
| 355 * The result is only available for [LibrarySpecificUnit]s. |
| 356 */ |
| 357 final ListResultDescriptor<VariableElement> PROPAGABLE_VARIABLES_IN_UNIT = |
| 358 new ListResultDescriptor<VariableElement>( |
| 359 'PROPAGABLE_VARIABLES_IN_UNIT', null); |
| 360 |
| 361 /** |
| 362 * An propagable variable ([VariableElement]) whose type has been propagated. |
| 363 * |
| 364 * The result is only available for [VariableElement]s. |
| 365 */ |
| 366 final ResultDescriptor<VariableElement> PROPAGATED_VARIABLE = |
| 367 new ResultDescriptor<VariableElement>('PROPAGATED_VARIABLE', null, |
| 368 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 369 |
| 370 /** |
| 341 * The flag specifying that [LIBRARY_ELEMENT2] is ready for a library and its | 371 * The flag specifying that [LIBRARY_ELEMENT2] is ready for a library and its |
| 342 * import/export closure. | 372 * import/export closure. |
| 343 * | 373 * |
| 344 * The result is only available for [Source]s representing a library. | 374 * The result is only available for [Source]s representing a library. |
| 345 */ | 375 */ |
| 346 final ResultDescriptor<bool> READY_LIBRARY_ELEMENT2 = | 376 final ResultDescriptor<bool> READY_LIBRARY_ELEMENT2 = |
| 347 new ResultDescriptor<bool>('READY_LIBRARY_ELEMENT2', false); | 377 new ResultDescriptor<bool>('READY_LIBRARY_ELEMENT2', false); |
| 348 | 378 |
| 349 /** | 379 /** |
| 350 * The flag specifying that [LIBRARY_ELEMENT5] is ready for a library and its | 380 * The flag specifying that [LIBRARY_ELEMENT5] is ready for a library and its |
| (...skipping 16 matching lines...) Expand all Loading... |
| 367 /** | 397 /** |
| 368 * The flag specifying that [RESOLVED_UNIT10] is ready for all of the units of a | 398 * The flag specifying that [RESOLVED_UNIT10] is ready for all of the units of a |
| 369 * library and its import/export closure. | 399 * library and its import/export closure. |
| 370 * | 400 * |
| 371 * The result is only available for [Source]s representing a library. | 401 * The result is only available for [Source]s representing a library. |
| 372 */ | 402 */ |
| 373 final ResultDescriptor<bool> READY_RESOLVED_UNIT10 = | 403 final ResultDescriptor<bool> READY_RESOLVED_UNIT10 = |
| 374 new ResultDescriptor<bool>('READY_RESOLVED_UNIT10', false); | 404 new ResultDescriptor<bool>('READY_RESOLVED_UNIT10', false); |
| 375 | 405 |
| 376 /** | 406 /** |
| 377 * The flag specifying that [RESOLVED_UNIT9] is ready for all of the units of a | 407 * The flag specifying that [RESOLVED_UNIT11] is ready for all of the units of a |
| 378 * library and its import/export closure. | 408 * library and its import/export closure. |
| 379 * | 409 * |
| 380 * The result is only available for [Source]s representing a library. | 410 * The result is only available for [Source]s representing a library. |
| 381 */ | 411 */ |
| 382 final ResultDescriptor<bool> READY_RESOLVED_UNIT9 = | 412 final ResultDescriptor<bool> READY_RESOLVED_UNIT11 = |
| 383 new ResultDescriptor<bool>('READY_RESOLVED_UNIT9', false); | 413 new ResultDescriptor<bool>('READY_RESOLVED_UNIT11', false); |
| 384 | 414 |
| 385 /** | 415 /** |
| 386 * The names (resolved and not) referenced by a unit. | 416 * The names (resolved and not) referenced by a unit. |
| 387 * | 417 * |
| 388 * The result is only available for [Source]s representing a compilation unit. | 418 * The result is only available for [Source]s representing a compilation unit. |
| 389 */ | 419 */ |
| 390 final ResultDescriptor<ReferencedNames> REFERENCED_NAMES = | 420 final ResultDescriptor<ReferencedNames> REFERENCED_NAMES = |
| 391 new ResultDescriptor<ReferencedNames>('REFERENCED_NAMES', null); | 421 new ResultDescriptor<ReferencedNames>('REFERENCED_NAMES', null); |
| 392 | 422 |
| 393 /** | 423 /** |
| (...skipping 26 matching lines...) Expand all Loading... |
| 420 * declaration, except for the constants defined in an 'enum' declaration. | 450 * declaration, except for the constants defined in an 'enum' declaration. |
| 421 * | 451 * |
| 422 * The result is only available for [LibrarySpecificUnit]s. | 452 * The result is only available for [LibrarySpecificUnit]s. |
| 423 */ | 453 */ |
| 424 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = | 454 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = |
| 425 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT1', null, | 455 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT1', null, |
| 426 cachingPolicy: AST_CACHING_POLICY); | 456 cachingPolicy: AST_CACHING_POLICY); |
| 427 | 457 |
| 428 /** | 458 /** |
| 429 * The resolved [CompilationUnit] associated with a compilation unit, with | 459 * The resolved [CompilationUnit] associated with a compilation unit, with |
| 430 * constants resolved. | 460 * constants not yet resolved. |
| 431 * | 461 * |
| 432 * The result is only available for [LibrarySpecificUnit]s. | 462 * The result is only available for [LibrarySpecificUnit]s. |
| 433 */ | 463 */ |
| 434 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT10 = | 464 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT10 = |
| 435 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT10', null, | 465 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT10', null, |
| 436 cachingPolicy: AST_CACHING_POLICY); | 466 cachingPolicy: AST_CACHING_POLICY); |
| 437 | 467 |
| 438 /** | 468 /** |
| 469 * The resolved [CompilationUnit] associated with a compilation unit, with |
| 470 * constants resolved. |
| 471 * |
| 472 * The result is only available for [LibrarySpecificUnit]s. |
| 473 */ |
| 474 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT11 = |
| 475 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT11', null, |
| 476 cachingPolicy: AST_CACHING_POLICY); |
| 477 |
| 478 /** |
| 439 * The partially resolved [CompilationUnit] associated with a compilation unit. | 479 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 440 * | 480 * |
| 441 * Tasks that use this value as an input can assume that the [SimpleIdentifier]s | 481 * Tasks that use this value as an input can assume that the [SimpleIdentifier]s |
| 442 * at all declaration sites have been bound to the element defined by the | 482 * at all declaration sites have been bound to the element defined by the |
| 443 * declaration, including the constants defined in an 'enum' declaration. | 483 * declaration, including the constants defined in an 'enum' declaration. |
| 444 * | 484 * |
| 445 * The result is only available for [LibrarySpecificUnit]s. | 485 * The result is only available for [LibrarySpecificUnit]s. |
| 446 */ | 486 */ |
| 447 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = | 487 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = |
| 448 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null, | 488 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 * The result is only available for [LibrarySpecificUnit]s. | 526 * The result is only available for [LibrarySpecificUnit]s. |
| 487 */ | 527 */ |
| 488 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = | 528 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = |
| 489 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, | 529 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, |
| 490 cachingPolicy: AST_CACHING_POLICY); | 530 cachingPolicy: AST_CACHING_POLICY); |
| 491 | 531 |
| 492 /** | 532 /** |
| 493 * The partially resolved [CompilationUnit] associated with a compilation unit. | 533 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 494 * | 534 * |
| 495 * In addition to what is true of a [RESOLVED_UNIT5], tasks that use this value | 535 * In addition to what is true of a [RESOLVED_UNIT5], tasks that use this value |
| 496 * as an input can assume that the types of static variables have been inferred. | 536 * as an input can assume that the types of final variables have been |
| 537 * propagated. |
| 497 * | 538 * |
| 498 * The result is only available for [LibrarySpecificUnit]s. | 539 * The result is only available for [LibrarySpecificUnit]s. |
| 499 */ | 540 */ |
| 500 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 = | 541 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 = |
| 501 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null, | 542 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null, |
| 502 cachingPolicy: AST_CACHING_POLICY); | 543 cachingPolicy: AST_CACHING_POLICY); |
| 503 | 544 |
| 504 /** | 545 /** |
| 505 * The partially resolved [CompilationUnit] associated with a compilation unit. | 546 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 506 * | 547 * |
| 507 * In addition to what is true of a [RESOLVED_UNIT6], tasks that use this value | 548 * In addition to what is true of a [RESOLVED_UNIT6], tasks that use this value |
| 508 * as an input can assume that the initializers of instance variables have been | 549 * as an input can assume that the types of static variables have been inferred. |
| 509 * re-resolved. | |
| 510 * | 550 * |
| 511 * The result is only available for [LibrarySpecificUnit]s. | 551 * The result is only available for [LibrarySpecificUnit]s. |
| 512 */ | 552 */ |
| 513 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT7 = | 553 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT7 = |
| 514 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT7', null, | 554 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT7', null, |
| 515 cachingPolicy: AST_CACHING_POLICY); | 555 cachingPolicy: AST_CACHING_POLICY); |
| 516 | 556 |
| 517 /** | 557 /** |
| 518 * The resolved [CompilationUnit] associated with a compilation unit in which | 558 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 519 * the types of class members have been inferred in addition to everything that | 559 * |
| 520 * is true of a [RESOLVED_UNIT7]. | 560 * In addition to what is true of a [RESOLVED_UNIT7], tasks that use this value |
| 561 * as an input can assume that the initializers of instance variables have been |
| 562 * re-resolved. |
| 521 * | 563 * |
| 522 * The result is only available for [LibrarySpecificUnit]s. | 564 * The result is only available for [LibrarySpecificUnit]s. |
| 523 */ | 565 */ |
| 524 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT8 = | 566 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT8 = |
| 525 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT8', null, | 567 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT8', null, |
| 526 cachingPolicy: AST_CACHING_POLICY); | 568 cachingPolicy: AST_CACHING_POLICY); |
| 527 | 569 |
| 528 /** | 570 /** |
| 529 * The resolved [CompilationUnit] associated with a compilation unit, with | 571 * The resolved [CompilationUnit] associated with a compilation unit in which |
| 530 * constants not yet resolved. | 572 * the types of class members have been inferred in addition to everything that |
| 573 * is true of a [RESOLVED_UNIT8]. |
| 531 * | 574 * |
| 532 * The result is only available for [LibrarySpecificUnit]s. | 575 * The result is only available for [LibrarySpecificUnit]s. |
| 533 */ | 576 */ |
| 534 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT9 = | 577 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT9 = |
| 535 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT9', null, | 578 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT9', null, |
| 536 cachingPolicy: AST_CACHING_POLICY); | 579 cachingPolicy: AST_CACHING_POLICY); |
| 537 | 580 |
| 538 /** | 581 /** |
| 539 * The errors produced while scanning a compilation unit. | 582 * The errors produced while scanning a compilation unit. |
| 540 * | 583 * |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 CompilationUnitElementImpl unit = target | 1674 CompilationUnitElementImpl unit = target |
| 1632 .getAncestor((Element element) => element is CompilationUnitElement); | 1675 .getAncestor((Element element) => element is CompilationUnitElement); |
| 1633 librarySource = unit.librarySource; | 1676 librarySource = unit.librarySource; |
| 1634 } else if (target is ConstantEvaluationTarget_Annotation) { | 1677 } else if (target is ConstantEvaluationTarget_Annotation) { |
| 1635 librarySource = target.librarySource; | 1678 librarySource = target.librarySource; |
| 1636 } else { | 1679 } else { |
| 1637 throw new AnalysisException( | 1680 throw new AnalysisException( |
| 1638 'Cannot build inputs for a ${target.runtimeType}'); | 1681 'Cannot build inputs for a ${target.runtimeType}'); |
| 1639 } | 1682 } |
| 1640 return <String, TaskInput>{ | 1683 return <String, TaskInput>{ |
| 1641 'resolvedUnit': RESOLVED_UNIT9 | 1684 'resolvedUnit': RESOLVED_UNIT10 |
| 1642 .of(new LibrarySpecificUnit(librarySource, target.source)), | 1685 .of(new LibrarySpecificUnit(librarySource, target.source)), |
| 1643 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 1686 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 1644 }; | 1687 }; |
| 1645 } | 1688 } |
| 1646 | 1689 |
| 1647 /** | 1690 /** |
| 1648 * Create a [ComputeConstantDependenciesTask] based on the given [target] in | 1691 * Create a [ComputeConstantDependenciesTask] based on the given [target] in |
| 1649 * the given [context]. | 1692 * the given [context]. |
| 1650 */ | 1693 */ |
| 1651 static ComputeConstantDependenciesTask createTask( | 1694 static ComputeConstantDependenciesTask createTask( |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 * Create a [ComputeLibraryCycleTask] based on the | 1976 * Create a [ComputeLibraryCycleTask] based on the |
| 1934 * given [target] in the given [context]. | 1977 * given [target] in the given [context]. |
| 1935 */ | 1978 */ |
| 1936 static ComputeLibraryCycleTask createTask( | 1979 static ComputeLibraryCycleTask createTask( |
| 1937 AnalysisContext context, AnalysisTarget target) { | 1980 AnalysisContext context, AnalysisTarget target) { |
| 1938 return new ComputeLibraryCycleTask(context, target); | 1981 return new ComputeLibraryCycleTask(context, target); |
| 1939 } | 1982 } |
| 1940 } | 1983 } |
| 1941 | 1984 |
| 1942 /** | 1985 /** |
| 1986 * A task that computes the [PROPAGABLE_VARIABLE_DEPENDENCIES] for a variable. |
| 1987 */ |
| 1988 class ComputePropagableVariableDependenciesTask |
| 1989 extends ConstantEvaluationAnalysisTask { |
| 1990 /** |
| 1991 * The name of the [RESOLVED_UNIT5] input. |
| 1992 */ |
| 1993 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1994 |
| 1995 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1996 'ComputePropagableVariableDependenciesTask', |
| 1997 createTask, |
| 1998 buildInputs, |
| 1999 <ResultDescriptor>[PROPAGABLE_VARIABLE_DEPENDENCIES]); |
| 2000 |
| 2001 ComputePropagableVariableDependenciesTask( |
| 2002 InternalAnalysisContext context, VariableElement variable) |
| 2003 : super(context, variable); |
| 2004 |
| 2005 @override |
| 2006 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2007 |
| 2008 @override |
| 2009 void internalPerform() { |
| 2010 // |
| 2011 // Prepare inputs. |
| 2012 // |
| 2013 VariableElement variable = target; |
| 2014 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 2015 // |
| 2016 // Compute dependencies. |
| 2017 // |
| 2018 NodeLocator locator = new NodeLocator(variable.nameOffset); |
| 2019 AstNode node = locator.searchWithin(unit); |
| 2020 VariableDeclaration declaration = |
| 2021 node.getAncestor((AstNode ancestor) => ancestor is VariableDeclaration); |
| 2022 if (declaration == null || declaration.name != node) { |
| 2023 throw new AnalysisException( |
| 2024 "NodeLocator failed to find a variable's declaration"); |
| 2025 } |
| 2026 VariableGatherer gatherer = new VariableGatherer(_isPropagable); |
| 2027 declaration.initializer.accept(gatherer); |
| 2028 // |
| 2029 // Record outputs. |
| 2030 // |
| 2031 outputs[PROPAGABLE_VARIABLE_DEPENDENCIES] = gatherer.results.toList(); |
| 2032 } |
| 2033 |
| 2034 /** |
| 2035 * Return `true` if the given [variable] is a variable whose type can be |
| 2036 * propagated. |
| 2037 */ |
| 2038 bool _isPropagable(VariableElement variable) => |
| 2039 (variable.isConst || variable.isFinal) && |
| 2040 variable.hasImplicitType && |
| 2041 variable.initializer != null; |
| 2042 |
| 2043 /** |
| 2044 * Return a map from the names of the inputs of this kind of task to the task |
| 2045 * input descriptors describing those inputs for a task with the |
| 2046 * given [target]. |
| 2047 */ |
| 2048 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2049 if (target is VariableElement) { |
| 2050 CompilationUnitElementImpl unit = target |
| 2051 .getAncestor((Element element) => element is CompilationUnitElement); |
| 2052 return <String, TaskInput>{ |
| 2053 UNIT_INPUT: RESOLVED_UNIT5 |
| 2054 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)) |
| 2055 }; |
| 2056 } |
| 2057 throw new AnalysisException( |
| 2058 'Cannot build inputs for a ${target.runtimeType}'); |
| 2059 } |
| 2060 |
| 2061 /** |
| 2062 * Create a [ComputePropagableVariableDependenciesTask] based on the |
| 2063 * given [target] in the given [context]. |
| 2064 */ |
| 2065 static ComputePropagableVariableDependenciesTask createTask( |
| 2066 AnalysisContext context, AnalysisTarget target) { |
| 2067 return new ComputePropagableVariableDependenciesTask(context, target); |
| 2068 } |
| 2069 } |
| 2070 |
| 2071 /** |
| 1943 * A base class for analysis tasks whose target is expected to be a | 2072 * A base class for analysis tasks whose target is expected to be a |
| 1944 * [ConstantEvaluationTarget]. | 2073 * [ConstantEvaluationTarget]. |
| 1945 */ | 2074 */ |
| 1946 abstract class ConstantEvaluationAnalysisTask extends AnalysisTask { | 2075 abstract class ConstantEvaluationAnalysisTask extends AnalysisTask { |
| 1947 /** | 2076 /** |
| 1948 * Initialize a newly created task to perform analysis within the given | 2077 * Initialize a newly created task to perform analysis within the given |
| 1949 * [context] in order to produce results for the given [constant]. | 2078 * [context] in order to produce results for the given [constant]. |
| 1950 */ | 2079 */ |
| 1951 ConstantEvaluationAnalysisTask( | 2080 ConstantEvaluationAnalysisTask( |
| 1952 AnalysisContext context, ConstantEvaluationTarget constant) | 2081 AnalysisContext context, ConstantEvaluationTarget constant) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 * Create a [DartErrorsTask] based on the given [target] in the given | 2324 * Create a [DartErrorsTask] based on the given [target] in the given |
| 2196 * [context]. | 2325 * [context]. |
| 2197 */ | 2326 */ |
| 2198 static DartErrorsTask createTask( | 2327 static DartErrorsTask createTask( |
| 2199 AnalysisContext context, AnalysisTarget target) { | 2328 AnalysisContext context, AnalysisTarget target) { |
| 2200 return new DartErrorsTask(context, target); | 2329 return new DartErrorsTask(context, target); |
| 2201 } | 2330 } |
| 2202 } | 2331 } |
| 2203 | 2332 |
| 2204 /** | 2333 /** |
| 2205 * A task that builds [RESOLVED_UNIT10] for a unit. | 2334 * A task that builds [RESOLVED_UNIT11] for a unit. |
| 2206 */ | 2335 */ |
| 2207 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { | 2336 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
| 2208 /** | 2337 /** |
| 2209 * The name of the [RESOLVED_UNIT9] input. | 2338 * The name of the [RESOLVED_UNIT10] input. |
| 2210 */ | 2339 */ |
| 2211 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2340 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2212 | 2341 |
| 2213 /** | 2342 /** |
| 2214 * The name of the [CONSTANT_VALUE] input. | 2343 * The name of the [CONSTANT_VALUE] input. |
| 2215 */ | 2344 */ |
| 2216 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; | 2345 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; |
| 2217 | 2346 |
| 2218 /** | 2347 /** |
| 2219 * The task descriptor describing this kind of task. | 2348 * The task descriptor describing this kind of task. |
| 2220 */ | 2349 */ |
| 2221 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2350 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2222 'EvaluateUnitConstantsTask', | 2351 'EvaluateUnitConstantsTask', |
| 2223 createTask, | 2352 createTask, |
| 2224 buildInputs, | 2353 buildInputs, |
| 2225 <ResultDescriptor>[RESOLVED_UNIT10]); | 2354 <ResultDescriptor>[RESOLVED_UNIT11]); |
| 2226 | 2355 |
| 2227 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) | 2356 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) |
| 2228 : super(context, target); | 2357 : super(context, target); |
| 2229 | 2358 |
| 2230 @override | 2359 @override |
| 2231 TaskDescriptor get descriptor => DESCRIPTOR; | 2360 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2232 | 2361 |
| 2233 @override | 2362 @override |
| 2234 void internalPerform() { | 2363 void internalPerform() { |
| 2235 // No actual work needs to be performed; the task manager will ensure that | 2364 // No actual work needs to be performed; the task manager will ensure that |
| 2236 // all constants are evaluated before this method is called. | 2365 // all constants are evaluated before this method is called. |
| 2237 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 2366 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 2238 outputs[RESOLVED_UNIT10] = unit; | 2367 outputs[RESOLVED_UNIT11] = unit; |
| 2239 } | 2368 } |
| 2240 | 2369 |
| 2241 /** | 2370 /** |
| 2242 * Return a map from the names of the inputs of this kind of task to the task | 2371 * Return a map from the names of the inputs of this kind of task to the task |
| 2243 * input descriptors describing those inputs for a task with the | 2372 * input descriptors describing those inputs for a task with the |
| 2244 * given [target]. | 2373 * given [target]. |
| 2245 */ | 2374 */ |
| 2246 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2375 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2247 LibrarySpecificUnit unit = target; | 2376 LibrarySpecificUnit unit = target; |
| 2248 return <String, TaskInput>{ | 2377 return <String, TaskInput>{ |
| 2249 'libraryElement': LIBRARY_ELEMENT.of(unit.library), | 2378 'libraryElement': LIBRARY_ELEMENT.of(unit.library), |
| 2250 UNIT_INPUT: RESOLVED_UNIT9.of(unit), | 2379 UNIT_INPUT: RESOLVED_UNIT10.of(unit), |
| 2251 CONSTANT_VALUES: | 2380 CONSTANT_VALUES: |
| 2252 COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE) | 2381 COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE) |
| 2253 }; | 2382 }; |
| 2254 } | 2383 } |
| 2255 | 2384 |
| 2256 /** | 2385 /** |
| 2257 * Create an [EvaluateUnitConstantsTask] based on the given [target] in | 2386 * Create an [EvaluateUnitConstantsTask] based on the given [target] in |
| 2258 * the given [context]. | 2387 * the given [context]. |
| 2259 */ | 2388 */ |
| 2260 static EvaluateUnitConstantsTask createTask( | 2389 static EvaluateUnitConstantsTask createTask( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2364 } | 2493 } |
| 2365 return newNames; | 2494 return newNames; |
| 2366 } | 2495 } |
| 2367 } | 2496 } |
| 2368 | 2497 |
| 2369 /** | 2498 /** |
| 2370 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. | 2499 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. |
| 2371 */ | 2500 */ |
| 2372 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { | 2501 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
| 2373 /** | 2502 /** |
| 2374 * The name of the [RESOLVED_UNIT9] input. | 2503 * The name of the [RESOLVED_UNIT10] input. |
| 2375 */ | 2504 */ |
| 2376 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2505 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2377 | 2506 |
| 2378 /** | 2507 /** |
| 2379 * The task descriptor describing this kind of task. | 2508 * The task descriptor describing this kind of task. |
| 2380 */ | 2509 */ |
| 2381 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2510 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2382 'GatherUsedImportedElementsTask', | 2511 'GatherUsedImportedElementsTask', |
| 2383 createTask, | 2512 createTask, |
| 2384 buildInputs, | 2513 buildInputs, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2408 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; | 2537 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; |
| 2409 } | 2538 } |
| 2410 | 2539 |
| 2411 /** | 2540 /** |
| 2412 * Return a map from the names of the inputs of this kind of task to the task | 2541 * Return a map from the names of the inputs of this kind of task to the task |
| 2413 * input descriptors describing those inputs for a task with the | 2542 * input descriptors describing those inputs for a task with the |
| 2414 * given [target]. | 2543 * given [target]. |
| 2415 */ | 2544 */ |
| 2416 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2545 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2417 LibrarySpecificUnit unit = target; | 2546 LibrarySpecificUnit unit = target; |
| 2418 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT9.of(unit)}; | 2547 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT10.of(unit)}; |
| 2419 } | 2548 } |
| 2420 | 2549 |
| 2421 /** | 2550 /** |
| 2422 * Create a [GatherUsedImportedElementsTask] based on the given [target] in | 2551 * Create a [GatherUsedImportedElementsTask] based on the given [target] in |
| 2423 * the given [context]. | 2552 * the given [context]. |
| 2424 */ | 2553 */ |
| 2425 static GatherUsedImportedElementsTask createTask( | 2554 static GatherUsedImportedElementsTask createTask( |
| 2426 AnalysisContext context, AnalysisTarget target) { | 2555 AnalysisContext context, AnalysisTarget target) { |
| 2427 return new GatherUsedImportedElementsTask(context, target); | 2556 return new GatherUsedImportedElementsTask(context, target); |
| 2428 } | 2557 } |
| 2429 } | 2558 } |
| 2430 | 2559 |
| 2431 /** | 2560 /** |
| 2432 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. | 2561 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. |
| 2433 */ | 2562 */ |
| 2434 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { | 2563 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
| 2435 /** | 2564 /** |
| 2436 * The name of the [RESOLVED_UNIT9] input. | 2565 * The name of the [RESOLVED_UNIT10] input. |
| 2437 */ | 2566 */ |
| 2438 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2567 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2439 | 2568 |
| 2440 /** | 2569 /** |
| 2441 * The task descriptor describing this kind of task. | 2570 * The task descriptor describing this kind of task. |
| 2442 */ | 2571 */ |
| 2443 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2572 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2444 'GatherUsedLocalElementsTask', | 2573 'GatherUsedLocalElementsTask', |
| 2445 createTask, | 2574 createTask, |
| 2446 buildInputs, | 2575 buildInputs, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2470 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; | 2599 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; |
| 2471 } | 2600 } |
| 2472 | 2601 |
| 2473 /** | 2602 /** |
| 2474 * Return a map from the names of the inputs of this kind of task to the task | 2603 * Return a map from the names of the inputs of this kind of task to the task |
| 2475 * input descriptors describing those inputs for a task with the | 2604 * input descriptors describing those inputs for a task with the |
| 2476 * given [target]. | 2605 * given [target]. |
| 2477 */ | 2606 */ |
| 2478 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2607 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2479 LibrarySpecificUnit unit = target; | 2608 LibrarySpecificUnit unit = target; |
| 2480 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT9.of(unit)}; | 2609 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT10.of(unit)}; |
| 2481 } | 2610 } |
| 2482 | 2611 |
| 2483 /** | 2612 /** |
| 2484 * Create a [GatherUsedLocalElementsTask] based on the given [target] in | 2613 * Create a [GatherUsedLocalElementsTask] based on the given [target] in |
| 2485 * the given [context]. | 2614 * the given [context]. |
| 2486 */ | 2615 */ |
| 2487 static GatherUsedLocalElementsTask createTask( | 2616 static GatherUsedLocalElementsTask createTask( |
| 2488 AnalysisContext context, AnalysisTarget target) { | 2617 AnalysisContext context, AnalysisTarget target) { |
| 2489 return new GatherUsedLocalElementsTask(context, target); | 2618 return new GatherUsedLocalElementsTask(context, target); |
| 2490 } | 2619 } |
| 2491 } | 2620 } |
| 2492 | 2621 |
| 2493 /** | 2622 /** |
| 2494 * A task that generates [HINTS] for a unit. | 2623 * A task that generates [HINTS] for a unit. |
| 2495 */ | 2624 */ |
| 2496 class GenerateHintsTask extends SourceBasedAnalysisTask { | 2625 class GenerateHintsTask extends SourceBasedAnalysisTask { |
| 2497 /** | 2626 /** |
| 2498 * The name of the [RESOLVED_UNIT9] input. | 2627 * The name of the [RESOLVED_UNIT10] input. |
| 2499 */ | 2628 */ |
| 2500 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; | 2629 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; |
| 2501 | 2630 |
| 2502 /** | 2631 /** |
| 2503 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. | 2632 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. |
| 2504 */ | 2633 */ |
| 2505 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; | 2634 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; |
| 2506 | 2635 |
| 2507 /** | 2636 /** |
| 2508 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. | 2637 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2694 * A task that ensures that all of the inferable instance members in a | 2823 * A task that ensures that all of the inferable instance members in a |
| 2695 * compilation unit have had their type inferred. | 2824 * compilation unit have had their type inferred. |
| 2696 */ | 2825 */ |
| 2697 class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { | 2826 class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { |
| 2698 /** | 2827 /** |
| 2699 * The name of the [TYPE_PROVIDER] input. | 2828 * The name of the [TYPE_PROVIDER] input. |
| 2700 */ | 2829 */ |
| 2701 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 2830 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 2702 | 2831 |
| 2703 /** | 2832 /** |
| 2704 * The name of the input whose value is the [RESOLVED_UNIT6] for the | 2833 * The name of the input whose value is the [RESOLVED_UNIT7] for the |
| 2705 * compilation unit. | 2834 * compilation unit. |
| 2706 */ | 2835 */ |
| 2707 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2836 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2708 | 2837 |
| 2709 /** | 2838 /** |
| 2710 * The task descriptor describing this kind of task. | 2839 * The task descriptor describing this kind of task. |
| 2711 */ | 2840 */ |
| 2712 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2841 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2713 'InferInstanceMembersInUnitTask', | 2842 'InferInstanceMembersInUnitTask', |
| 2714 createTask, | 2843 createTask, |
| 2715 buildInputs, | 2844 buildInputs, |
| 2716 <ResultDescriptor>[RESOLVED_UNIT8]); | 2845 <ResultDescriptor>[RESOLVED_UNIT9]); |
| 2717 | 2846 |
| 2718 /** | 2847 /** |
| 2719 * Initialize a newly created task to build a library element for the given | 2848 * Initialize a newly created task to build a library element for the given |
| 2720 * [unit] in the given [context]. | 2849 * [unit] in the given [context]. |
| 2721 */ | 2850 */ |
| 2722 InferInstanceMembersInUnitTask( | 2851 InferInstanceMembersInUnitTask( |
| 2723 InternalAnalysisContext context, LibrarySpecificUnit unit) | 2852 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 2724 : super(context, unit); | 2853 : super(context, unit); |
| 2725 | 2854 |
| 2726 @override | 2855 @override |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2737 // Infer instance members. | 2866 // Infer instance members. |
| 2738 // | 2867 // |
| 2739 if (context.analysisOptions.strongMode) { | 2868 if (context.analysisOptions.strongMode) { |
| 2740 InstanceMemberInferrer inferrer = new InstanceMemberInferrer(typeProvider, | 2869 InstanceMemberInferrer inferrer = new InstanceMemberInferrer(typeProvider, |
| 2741 typeSystem: context.typeSystem); | 2870 typeSystem: context.typeSystem); |
| 2742 inferrer.inferCompilationUnit(unit.element); | 2871 inferrer.inferCompilationUnit(unit.element); |
| 2743 } | 2872 } |
| 2744 // | 2873 // |
| 2745 // Record outputs. | 2874 // Record outputs. |
| 2746 // | 2875 // |
| 2747 outputs[RESOLVED_UNIT8] = unit; | 2876 outputs[RESOLVED_UNIT9] = unit; |
| 2748 } | 2877 } |
| 2749 | 2878 |
| 2750 /** | 2879 /** |
| 2751 * Return a map from the names of the inputs of this kind of task to the task | 2880 * Return a map from the names of the inputs of this kind of task to the task |
| 2752 * input descriptors describing those inputs for a task with the given | 2881 * input descriptors describing those inputs for a task with the given |
| 2753 * [libSource]. | 2882 * [libSource]. |
| 2754 */ | 2883 */ |
| 2755 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2884 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2756 LibrarySpecificUnit unit = target; | 2885 LibrarySpecificUnit unit = target; |
| 2757 return <String, TaskInput>{ | 2886 return <String, TaskInput>{ |
| 2758 UNIT_INPUT: RESOLVED_UNIT7.of(unit), | 2887 UNIT_INPUT: RESOLVED_UNIT8.of(unit), |
| 2759 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 2888 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 2760 // In strong mode, add additional dependencies to enforce inference | 2889 // In strong mode, add additional dependencies to enforce inference |
| 2761 // ordering. | 2890 // ordering. |
| 2762 | 2891 |
| 2763 // Require that field re-resolution be complete for all units in the | 2892 // Require that field re-resolution be complete for all units in the |
| 2764 // current library cycle. | 2893 // current library cycle. |
| 2765 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( | 2894 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( |
| 2766 (CompilationUnitElementImpl unit) => RESOLVED_UNIT7 | 2895 (CompilationUnitElementImpl unit) => RESOLVED_UNIT8 |
| 2767 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))), | 2896 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))), |
| 2768 // Require that full inference be complete for all dependencies of the | 2897 // Require that full inference be complete for all dependencies of the |
| 2769 // current library cycle. | 2898 // current library cycle. |
| 2770 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 2899 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 2771 (CompilationUnitElementImpl unit) => RESOLVED_UNIT8 | 2900 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 |
| 2772 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) | 2901 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) |
| 2773 }; | 2902 }; |
| 2774 } | 2903 } |
| 2775 | 2904 |
| 2776 /** | 2905 /** |
| 2777 * Create a [InferInstanceMembersInUnitTask] based on the given [target] in | 2906 * Create a [InferInstanceMembersInUnitTask] based on the given [target] in |
| 2778 * the given [context]. | 2907 * the given [context]. |
| 2779 */ | 2908 */ |
| 2780 static InferInstanceMembersInUnitTask createTask( | 2909 static InferInstanceMembersInUnitTask createTask( |
| 2781 AnalysisContext context, AnalysisTarget target) { | 2910 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2809 return declaration; | 2938 return declaration; |
| 2810 } | 2939 } |
| 2811 } | 2940 } |
| 2812 | 2941 |
| 2813 /** | 2942 /** |
| 2814 * A task that ensures that all of the inferable static variables in a | 2943 * A task that ensures that all of the inferable static variables in a |
| 2815 * compilation unit have had their type inferred. | 2944 * compilation unit have had their type inferred. |
| 2816 */ | 2945 */ |
| 2817 class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask { | 2946 class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
| 2818 /** | 2947 /** |
| 2819 * The name of the input whose value is the [RESOLVED_UNIT5] for the | 2948 * The name of the input whose value is the [RESOLVED_UNIT6] for the |
| 2820 * compilation unit. | 2949 * compilation unit. |
| 2821 */ | 2950 */ |
| 2822 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2951 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2823 | 2952 |
| 2824 /** | 2953 /** |
| 2825 * The name of the input whose value is a list of the inferable static | 2954 * The name of the input whose value is a list of the inferable static |
| 2826 * variables whose types have been computed. | 2955 * variables whose types have been computed. |
| 2827 */ | 2956 */ |
| 2828 static const String INFERRED_VARIABLES_INPUT = 'INFERRED_VARIABLES_INPUT'; | 2957 static const String INFERRED_VARIABLES_INPUT = 'INFERRED_VARIABLES_INPUT'; |
| 2829 | 2958 |
| 2830 /** | 2959 /** |
| 2831 * The task descriptor describing this kind of task. | 2960 * The task descriptor describing this kind of task. |
| 2832 */ | 2961 */ |
| 2833 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2962 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2834 'InferStaticVariableTypesInUnitTask', | 2963 'InferStaticVariableTypesInUnitTask', |
| 2835 createTask, | 2964 createTask, |
| 2836 buildInputs, | 2965 buildInputs, |
| 2837 <ResultDescriptor>[RESOLVED_UNIT6]); | 2966 <ResultDescriptor>[RESOLVED_UNIT7]); |
| 2838 | 2967 |
| 2839 /** | 2968 /** |
| 2840 * Initialize a newly created task to build a library element for the given | 2969 * Initialize a newly created task to build a library element for the given |
| 2841 * [unit] in the given [context]. | 2970 * [unit] in the given [context]. |
| 2842 */ | 2971 */ |
| 2843 InferStaticVariableTypesInUnitTask( | 2972 InferStaticVariableTypesInUnitTask( |
| 2844 InternalAnalysisContext context, LibrarySpecificUnit unit) | 2973 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 2845 : super(context, unit); | 2974 : super(context, unit); |
| 2846 | 2975 |
| 2847 @override | 2976 @override |
| 2848 TaskDescriptor get descriptor => DESCRIPTOR; | 2977 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2849 | 2978 |
| 2850 @override | 2979 @override |
| 2851 void internalPerform() { | 2980 void internalPerform() { |
| 2852 // | 2981 // |
| 2853 // Prepare inputs. | 2982 // Prepare inputs. |
| 2854 // | 2983 // |
| 2855 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 2984 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 2856 // | 2985 // |
| 2857 // Record outputs. There is no additional work to be done at this time | 2986 // Record outputs. There is no additional work to be done at this time |
| 2858 // because the work has implicitly been done by virtue of the task model | 2987 // because the work has implicitly been done by virtue of the task model |
| 2859 // preparing all of the inputs. | 2988 // preparing all of the inputs. |
| 2860 // | 2989 // |
| 2861 outputs[RESOLVED_UNIT6] = unit; | 2990 outputs[RESOLVED_UNIT7] = unit; |
| 2862 } | 2991 } |
| 2863 | 2992 |
| 2864 /** | 2993 /** |
| 2865 * Return a map from the names of the inputs of this kind of task to the task | 2994 * Return a map from the names of the inputs of this kind of task to the task |
| 2866 * input descriptors describing those inputs for a task with the given | 2995 * input descriptors describing those inputs for a task with the given |
| 2867 * [libSource]. | 2996 * [libSource]. |
| 2868 */ | 2997 */ |
| 2869 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2998 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2870 LibrarySpecificUnit unit = target; | 2999 LibrarySpecificUnit unit = target; |
| 2871 return <String, TaskInput>{ | 3000 return <String, TaskInput>{ |
| 2872 INFERRED_VARIABLES_INPUT: INFERABLE_STATIC_VARIABLES_IN_UNIT | 3001 INFERRED_VARIABLES_INPUT: INFERABLE_STATIC_VARIABLES_IN_UNIT |
| 2873 .of(unit) | 3002 .of(unit) |
| 2874 .toListOf(INFERRED_STATIC_VARIABLE), | 3003 .toListOf(INFERRED_STATIC_VARIABLE), |
| 2875 UNIT_INPUT: RESOLVED_UNIT5.of(unit) | 3004 UNIT_INPUT: RESOLVED_UNIT6.of(unit) |
| 2876 }; | 3005 }; |
| 2877 } | 3006 } |
| 2878 | 3007 |
| 2879 /** | 3008 /** |
| 2880 * Create a [InferStaticVariableTypesInUnitTask] based on the given [target] | 3009 * Create a [InferStaticVariableTypesInUnitTask] based on the given [target] |
| 2881 * in the given [context]. | 3010 * in the given [context]. |
| 2882 */ | 3011 */ |
| 2883 static InferStaticVariableTypesInUnitTask createTask( | 3012 static InferStaticVariableTypesInUnitTask createTask( |
| 2884 AnalysisContext context, AnalysisTarget target) { | 3013 AnalysisContext context, AnalysisTarget target) { |
| 2885 return new InferStaticVariableTypesInUnitTask(context, target); | 3014 return new InferStaticVariableTypesInUnitTask(context, target); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2896 * inferred before the target. | 3025 * inferred before the target. |
| 2897 */ | 3026 */ |
| 2898 static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT'; | 3027 static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT'; |
| 2899 | 3028 |
| 2900 /** | 3029 /** |
| 2901 * The name of the [TYPE_PROVIDER] input. | 3030 * The name of the [TYPE_PROVIDER] input. |
| 2902 */ | 3031 */ |
| 2903 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 3032 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 2904 | 3033 |
| 2905 /** | 3034 /** |
| 2906 * The name of the [RESOLVED_UNIT5] input. | 3035 * The name of the [RESOLVED_UNIT6] input. |
| 2907 */ | 3036 */ |
| 2908 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3037 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2909 | 3038 |
| 2910 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3039 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2911 'InferStaticVariableTypeTask', | 3040 'InferStaticVariableTypeTask', |
| 2912 createTask, | 3041 createTask, |
| 2913 buildInputs, | 3042 buildInputs, |
| 2914 <ResultDescriptor>[INFERRED_STATIC_VARIABLE]); | 3043 <ResultDescriptor>[INFERRED_STATIC_VARIABLE]); |
| 2915 | 3044 |
| 2916 InferStaticVariableTypeTask( | 3045 InferStaticVariableTypeTask( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 */ | 3123 */ |
| 2995 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3124 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2996 VariableElement variable = target; | 3125 VariableElement variable = target; |
| 2997 LibrarySpecificUnit unit = | 3126 LibrarySpecificUnit unit = |
| 2998 new LibrarySpecificUnit(variable.library.source, variable.source); | 3127 new LibrarySpecificUnit(variable.library.source, variable.source); |
| 2999 return <String, TaskInput>{ | 3128 return <String, TaskInput>{ |
| 3000 DEPENDENCIES_INPUT: INFERABLE_STATIC_VARIABLE_DEPENDENCIES | 3129 DEPENDENCIES_INPUT: INFERABLE_STATIC_VARIABLE_DEPENDENCIES |
| 3001 .of(variable) | 3130 .of(variable) |
| 3002 .toListOf(INFERRED_STATIC_VARIABLE), | 3131 .toListOf(INFERRED_STATIC_VARIABLE), |
| 3003 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 3132 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 3004 UNIT_INPUT: RESOLVED_UNIT5.of(unit), | 3133 UNIT_INPUT: RESOLVED_UNIT6.of(unit), |
| 3005 // In strong mode, add additional dependencies to enforce inference | 3134 // In strong mode, add additional dependencies to enforce inference |
| 3006 // ordering. | 3135 // ordering. |
| 3007 | 3136 |
| 3008 // Require that full inference be complete for all dependencies of the | 3137 // Require that full inference be complete for all dependencies of the |
| 3009 // current library cycle. | 3138 // current library cycle. |
| 3010 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 3139 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 3011 (CompilationUnitElementImpl unit) => RESOLVED_UNIT8 | 3140 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 |
| 3012 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) | 3141 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) |
| 3013 }; | 3142 }; |
| 3014 } | 3143 } |
| 3015 | 3144 |
| 3016 /** | 3145 /** |
| 3017 * Create a [InferStaticVariableTypeTask] based on the given [target] in the | 3146 * Create a [InferStaticVariableTypeTask] based on the given [target] in the |
| 3018 * given [context]. | 3147 * given [context]. |
| 3019 */ | 3148 */ |
| 3020 static InferStaticVariableTypeTask createTask( | 3149 static InferStaticVariableTypeTask createTask( |
| 3021 AnalysisContext context, AnalysisTarget target) { | 3150 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3411 * The name of the [TYPE_PROVIDER] input. | 3540 * The name of the [TYPE_PROVIDER] input. |
| 3412 */ | 3541 */ |
| 3413 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 3542 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 3414 | 3543 |
| 3415 /** | 3544 /** |
| 3416 * The task descriptor describing this kind of task. | 3545 * The task descriptor describing this kind of task. |
| 3417 */ | 3546 */ |
| 3418 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3547 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3419 'PartiallyResolveUnitReferencesTask', | 3548 'PartiallyResolveUnitReferencesTask', |
| 3420 createTask, | 3549 createTask, |
| 3421 buildInputs, | 3550 buildInputs, <ResultDescriptor>[ |
| 3422 <ResultDescriptor>[INFERABLE_STATIC_VARIABLES_IN_UNIT, RESOLVED_UNIT5]); | 3551 INFERABLE_STATIC_VARIABLES_IN_UNIT, |
| 3552 PROPAGABLE_VARIABLES_IN_UNIT, |
| 3553 RESOLVED_UNIT5 |
| 3554 ]); |
| 3423 | 3555 |
| 3424 PartiallyResolveUnitReferencesTask( | 3556 PartiallyResolveUnitReferencesTask( |
| 3425 InternalAnalysisContext context, AnalysisTarget target) | 3557 InternalAnalysisContext context, AnalysisTarget target) |
| 3426 : super(context, target); | 3558 : super(context, target); |
| 3427 | 3559 |
| 3428 @override | 3560 @override |
| 3429 TaskDescriptor get descriptor => DESCRIPTOR; | 3561 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3430 | 3562 |
| 3431 @override | 3563 @override |
| 3432 void internalPerform() { | 3564 void internalPerform() { |
| 3433 // | 3565 // |
| 3434 // Prepare inputs. | 3566 // Prepare inputs. |
| 3435 // | 3567 // |
| 3436 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT); | 3568 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT); |
| 3437 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 3569 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3438 CompilationUnitElement unitElement = unit.element; | 3570 CompilationUnitElement unitElement = unit.element; |
| 3439 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 3571 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 3440 // | 3572 // |
| 3441 // Resolve references and record outputs. | 3573 // Resolve references and record outputs. |
| 3442 // | 3574 // |
| 3575 InheritanceManager inheritanceManager = |
| 3576 new InheritanceManager(libraryElement); |
| 3577 PartialResolverVisitor visitor = new PartialResolverVisitor(libraryElement, |
| 3578 unitElement.source, typeProvider, AnalysisErrorListener.NULL_LISTENER, |
| 3579 inheritanceManager: inheritanceManager); |
| 3580 unit.accept(visitor); |
| 3581 // |
| 3582 // Record outputs. |
| 3583 // |
| 3443 if (context.analysisOptions.strongMode) { | 3584 if (context.analysisOptions.strongMode) { |
| 3444 InheritanceManager inheritanceManager = | 3585 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables; |
| 3445 new InheritanceManager(libraryElement); | |
| 3446 PartialResolverVisitor visitor = new PartialResolverVisitor( | |
| 3447 libraryElement, | |
| 3448 unitElement.source, | |
| 3449 typeProvider, | |
| 3450 AnalysisErrorListener.NULL_LISTENER, | |
| 3451 inheritanceManager: inheritanceManager); | |
| 3452 unit.accept(visitor); | |
| 3453 | |
| 3454 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.variablesAndFields; | |
| 3455 } else { | 3586 } else { |
| 3456 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = []; | 3587 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = VariableElement.EMPTY_LIST; |
| 3457 } | 3588 } |
| 3589 outputs[PROPAGABLE_VARIABLES_IN_UNIT] = visitor.propagableVariables; |
| 3458 outputs[RESOLVED_UNIT5] = unit; | 3590 outputs[RESOLVED_UNIT5] = unit; |
| 3459 } | 3591 } |
| 3460 | 3592 |
| 3461 /** | 3593 /** |
| 3462 * Return a map from the names of the inputs of this kind of task to the task | 3594 * Return a map from the names of the inputs of this kind of task to the task |
| 3463 * input descriptors describing those inputs for a task with the | 3595 * input descriptors describing those inputs for a task with the |
| 3464 * given [target]. | 3596 * given [target]. |
| 3465 */ | 3597 */ |
| 3466 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3598 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3467 LibrarySpecificUnit unit = target; | 3599 LibrarySpecificUnit unit = target; |
| 3468 return <String, TaskInput>{ | 3600 return <String, TaskInput>{ |
| 3469 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library), | 3601 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library), |
| 3470 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), | 3602 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), |
| 3471 UNIT_INPUT: RESOLVED_UNIT4.of(unit), | 3603 UNIT_INPUT: RESOLVED_UNIT4.of(unit), |
| 3472 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 3604 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 3473 // In strong mode, add additional dependencies to enforce inference | 3605 // In strong mode, add additional dependencies to enforce inference |
| 3474 // ordering. | 3606 // ordering. |
| 3475 | 3607 |
| 3476 // Require that full inference be complete for all dependencies of the | 3608 // Require that full inference be complete for all dependencies of the |
| 3477 // current library cycle. | 3609 // current library cycle. |
| 3478 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 3610 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 3479 (CompilationUnitElementImpl unit) => RESOLVED_UNIT8 | 3611 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 |
| 3480 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) | 3612 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) |
| 3481 }; | 3613 }; |
| 3482 } | 3614 } |
| 3483 | 3615 |
| 3484 /** | 3616 /** |
| 3485 * Create a [PartiallyResolveUnitReferencesTask] based on the given [target] | 3617 * Create a [PartiallyResolveUnitReferencesTask] based on the given [target] |
| 3486 * in the given [context]. | 3618 * in the given [context]. |
| 3487 */ | 3619 */ |
| 3488 static PartiallyResolveUnitReferencesTask createTask( | 3620 static PartiallyResolveUnitReferencesTask createTask( |
| 3489 AnalysisContext context, AnalysisTarget target) { | 3621 AnalysisContext context, AnalysisTarget target) { |
| 3490 return new PartiallyResolveUnitReferencesTask(context, target); | 3622 return new PartiallyResolveUnitReferencesTask(context, target); |
| 3491 } | 3623 } |
| 3492 } | 3624 } |
| 3493 | 3625 |
| 3494 /** | 3626 /** |
| 3627 * A task that ensures that all of the propagable variables in a compilation |
| 3628 * unit have had their type propagated. |
| 3629 */ |
| 3630 class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
| 3631 /** |
| 3632 * The name of the input whose value is the [RESOLVED_UNIT5] for the |
| 3633 * compilation unit. |
| 3634 */ |
| 3635 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3636 |
| 3637 /** |
| 3638 * The task descriptor describing this kind of task. |
| 3639 */ |
| 3640 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3641 'PropagateVariableTypesInUnitTask', |
| 3642 createTask, |
| 3643 buildInputs, |
| 3644 <ResultDescriptor>[RESOLVED_UNIT6]); |
| 3645 |
| 3646 PropagateVariableTypesInUnitTask( |
| 3647 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 3648 : super(context, unit); |
| 3649 |
| 3650 @override |
| 3651 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3652 |
| 3653 @override |
| 3654 void internalPerform() { |
| 3655 // |
| 3656 // Prepare inputs. |
| 3657 // |
| 3658 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3659 // |
| 3660 // Record outputs. There is no additional work to be done at this time |
| 3661 // because the work has implicitly been done by virtue of the task model |
| 3662 // preparing all of the inputs. |
| 3663 // |
| 3664 outputs[RESOLVED_UNIT6] = unit; |
| 3665 } |
| 3666 |
| 3667 /** |
| 3668 * Return a map from the names of the inputs of this kind of task to the task |
| 3669 * input descriptors describing those inputs for a task with the given |
| 3670 * [target]. |
| 3671 */ |
| 3672 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3673 LibrarySpecificUnit unit = target; |
| 3674 return <String, TaskInput>{ |
| 3675 'variables': |
| 3676 PROPAGABLE_VARIABLES_IN_UNIT.of(unit).toListOf(PROPAGATED_VARIABLE), |
| 3677 UNIT_INPUT: RESOLVED_UNIT5.of(unit) |
| 3678 }; |
| 3679 } |
| 3680 |
| 3681 /** |
| 3682 * Create a [PropagateVariableTypesInUnitTask] based on the given [target] |
| 3683 * in the given [context]. |
| 3684 */ |
| 3685 static PropagateVariableTypesInUnitTask createTask( |
| 3686 AnalysisContext context, AnalysisTarget target) { |
| 3687 return new PropagateVariableTypesInUnitTask(context, target); |
| 3688 } |
| 3689 } |
| 3690 |
| 3691 /** |
| 3692 * A task that computes the propagated type of an propagable variable and |
| 3693 * stores it in the element model. |
| 3694 */ |
| 3695 class PropagateVariableTypeTask extends InferStaticVariableTask { |
| 3696 /** |
| 3697 * The name of the [TYPE_PROVIDER] input. |
| 3698 */ |
| 3699 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 3700 |
| 3701 /** |
| 3702 * The name of the [RESOLVED_UNIT5] input. |
| 3703 */ |
| 3704 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3705 |
| 3706 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3707 'PropagateVariableTypeTask', |
| 3708 createTask, |
| 3709 buildInputs, |
| 3710 <ResultDescriptor>[PROPAGATED_VARIABLE]); |
| 3711 |
| 3712 PropagateVariableTypeTask( |
| 3713 InternalAnalysisContext context, VariableElement variable) |
| 3714 : super(context, variable); |
| 3715 |
| 3716 @override |
| 3717 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3718 |
| 3719 @override |
| 3720 bool get handlesDependencyCycles => true; |
| 3721 |
| 3722 @override |
| 3723 void internalPerform() { |
| 3724 // |
| 3725 // Prepare inputs. |
| 3726 // |
| 3727 PropertyInducingElementImpl variable = target; |
| 3728 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 3729 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3730 |
| 3731 // If we're not in a dependency cycle, and we have no type annotation, |
| 3732 // re-resolve the right hand side and do propagation. |
| 3733 if (dependencyCycle == null && variable.hasImplicitType) { |
| 3734 VariableDeclaration declaration = getDeclaration(unit); |
| 3735 // |
| 3736 // Re-resolve the variable's initializer with the propagated types of |
| 3737 // other variables. |
| 3738 // |
| 3739 Expression initializer = declaration.initializer; |
| 3740 ResolutionContext resolutionContext = ResolutionContextBuilder.contextFor( |
| 3741 initializer, AnalysisErrorListener.NULL_LISTENER); |
| 3742 ResolverVisitor visitor = new ResolverVisitor(variable.library, |
| 3743 variable.source, typeProvider, AnalysisErrorListener.NULL_LISTENER, |
| 3744 nameScope: resolutionContext.scope); |
| 3745 if (resolutionContext.enclosingClassDeclaration != null) { |
| 3746 visitor.prepareToResolveMembersInClass( |
| 3747 resolutionContext.enclosingClassDeclaration); |
| 3748 } |
| 3749 visitor.initForIncrementalResolution(); |
| 3750 initializer.accept(visitor); |
| 3751 // |
| 3752 // Record the type of the variable. |
| 3753 // |
| 3754 DartType newType = initializer.bestType; |
| 3755 if (newType != null && !newType.isBottom && !newType.isDynamic) { |
| 3756 variable.propagatedType = newType; |
| 3757 } |
| 3758 } |
| 3759 // |
| 3760 // Record outputs. |
| 3761 // |
| 3762 outputs[PROPAGATED_VARIABLE] = variable; |
| 3763 } |
| 3764 |
| 3765 /** |
| 3766 * Return a map from the names of the inputs of this kind of task to the task |
| 3767 * input descriptors describing those inputs for a task with the given |
| 3768 * [target]. |
| 3769 */ |
| 3770 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3771 VariableElement variable = target; |
| 3772 LibrarySpecificUnit unit = |
| 3773 new LibrarySpecificUnit(variable.library.source, variable.source); |
| 3774 return <String, TaskInput>{ |
| 3775 'dependencies': PROPAGABLE_VARIABLE_DEPENDENCIES |
| 3776 .of(variable) |
| 3777 .toListOf(PROPAGATED_VARIABLE), |
| 3778 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 3779 UNIT_INPUT: RESOLVED_UNIT5.of(unit), |
| 3780 }; |
| 3781 } |
| 3782 |
| 3783 /** |
| 3784 * Create a [PropagateVariableTypeTask] based on the given [target] in the |
| 3785 * given [context]. |
| 3786 */ |
| 3787 static PropagateVariableTypeTask createTask( |
| 3788 AnalysisContext context, AnalysisTarget target) { |
| 3789 return new PropagateVariableTypeTask(context, target); |
| 3790 } |
| 3791 } |
| 3792 |
| 3793 /** |
| 3495 * The helper for building the public [Namespace] of a [LibraryElement]. | 3794 * The helper for building the public [Namespace] of a [LibraryElement]. |
| 3496 */ | 3795 */ |
| 3497 class PublicNamespaceBuilder { | 3796 class PublicNamespaceBuilder { |
| 3498 final HashMap<String, Element> definedNames = new HashMap<String, Element>(); | 3797 final HashMap<String, Element> definedNames = new HashMap<String, Element>(); |
| 3499 | 3798 |
| 3500 /** | 3799 /** |
| 3501 * Build a public [Namespace] of the given [library]. | 3800 * Build a public [Namespace] of the given [library]. |
| 3502 */ | 3801 */ |
| 3503 Namespace build(LibraryElement library) { | 3802 Namespace build(LibraryElement library) { |
| 3504 definedNames.clear(); | 3803 definedNames.clear(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3654 }; | 3953 }; |
| 3655 } | 3954 } |
| 3656 | 3955 |
| 3657 static ReadyResolvedUnit10Task createTask( | 3956 static ReadyResolvedUnit10Task createTask( |
| 3658 AnalysisContext context, AnalysisTarget target) { | 3957 AnalysisContext context, AnalysisTarget target) { |
| 3659 return new ReadyResolvedUnit10Task(context, target); | 3958 return new ReadyResolvedUnit10Task(context, target); |
| 3660 } | 3959 } |
| 3661 } | 3960 } |
| 3662 | 3961 |
| 3663 /** | 3962 /** |
| 3664 * A task that ensures that [RESOLVED_UNIT9] is ready for every unit of the | 3963 * A task that ensures that [RESOLVED_UNIT11] is ready for every unit of the |
| 3665 * target library source and its import/export closure. | 3964 * target library source and its import/export closure. |
| 3666 */ | 3965 */ |
| 3667 class ReadyResolvedUnit9Task extends SourceBasedAnalysisTask { | 3966 class ReadyResolvedUnit11Task extends SourceBasedAnalysisTask { |
| 3668 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3967 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3669 'ReadyResolvedUnit9Task', | 3968 'ReadyResolvedUnit11Task', |
| 3670 createTask, | 3969 createTask, |
| 3671 buildInputs, | 3970 buildInputs, |
| 3672 <ResultDescriptor>[READY_RESOLVED_UNIT9]); | 3971 <ResultDescriptor>[READY_RESOLVED_UNIT11]); |
| 3673 | 3972 |
| 3674 ReadyResolvedUnit9Task(InternalAnalysisContext context, AnalysisTarget target) | 3973 ReadyResolvedUnit11Task( |
| 3974 InternalAnalysisContext context, AnalysisTarget target) |
| 3675 : super(context, target); | 3975 : super(context, target); |
| 3676 | 3976 |
| 3677 @override | 3977 @override |
| 3678 TaskDescriptor get descriptor => DESCRIPTOR; | 3978 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3679 | 3979 |
| 3680 @override | 3980 @override |
| 3681 bool get handlesDependencyCycles => true; | 3981 bool get handlesDependencyCycles => true; |
| 3682 | 3982 |
| 3683 @override | 3983 @override |
| 3684 void internalPerform() { | 3984 void internalPerform() { |
| 3685 outputs[READY_RESOLVED_UNIT9] = true; | 3985 outputs[READY_RESOLVED_UNIT11] = true; |
| 3686 } | 3986 } |
| 3687 | 3987 |
| 3688 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3988 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3689 Source source = target; | 3989 Source source = target; |
| 3690 return <String, TaskInput>{ | 3990 return <String, TaskInput>{ |
| 3691 'thisLibraryUnitsReady': | 3991 'thisLibraryUnitsReady': |
| 3692 LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT9), | 3992 LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT11), |
| 3693 'directlyImportedLibrariesReady': | 3993 'directlyImportedLibrariesReady': |
| 3694 IMPORTED_LIBRARIES.of(source).toListOf(READY_RESOLVED_UNIT9), | 3994 IMPORTED_LIBRARIES.of(source).toListOf(READY_RESOLVED_UNIT11), |
| 3695 'directlyExportedLibrariesReady': | 3995 'directlyExportedLibrariesReady': |
| 3696 EXPORTED_LIBRARIES.of(source).toListOf(READY_RESOLVED_UNIT9), | 3996 EXPORTED_LIBRARIES.of(source).toListOf(READY_RESOLVED_UNIT11), |
| 3697 }; | 3997 }; |
| 3698 } | 3998 } |
| 3699 | 3999 |
| 3700 static ReadyResolvedUnit9Task createTask( | 4000 static ReadyResolvedUnit11Task createTask( |
| 3701 AnalysisContext context, AnalysisTarget target) { | 4001 AnalysisContext context, AnalysisTarget target) { |
| 3702 return new ReadyResolvedUnit9Task(context, target); | 4002 return new ReadyResolvedUnit11Task(context, target); |
| 3703 } | 4003 } |
| 3704 } | 4004 } |
| 3705 | 4005 |
| 3706 /** | 4006 /** |
| 3707 * A task that ensures that [RESOLVED_UNIT] is ready for every unit of the | 4007 * A task that ensures that [RESOLVED_UNIT] is ready for every unit of the |
| 3708 * target library source and its import/export closure. | 4008 * target library source and its import/export closure. |
| 3709 */ | 4009 */ |
| 3710 class ReadyResolvedUnitTask extends SourceBasedAnalysisTask { | 4010 class ReadyResolvedUnitTask extends SourceBasedAnalysisTask { |
| 3711 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4011 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3712 'ReadyResolvedUnitTask', | 4012 'ReadyResolvedUnitTask', |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3853 * The name of the [LIBRARY_ELEMENT5] input. | 4153 * The name of the [LIBRARY_ELEMENT5] input. |
| 3854 */ | 4154 */ |
| 3855 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4155 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 3856 | 4156 |
| 3857 /** | 4157 /** |
| 3858 * The name of the [TYPE_PROVIDER] input. | 4158 * The name of the [TYPE_PROVIDER] input. |
| 3859 */ | 4159 */ |
| 3860 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 4160 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 3861 | 4161 |
| 3862 /** | 4162 /** |
| 3863 * The name of the input whose value is the [RESOLVED_UNIT6] for the | 4163 * The name of the input whose value is the [RESOLVED_UNIT7] for the |
| 3864 * compilation unit. | 4164 * compilation unit. |
| 3865 */ | 4165 */ |
| 3866 static const String UNIT_INPUT = 'UNIT_INPUT'; | 4166 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3867 | 4167 |
| 3868 /** | 4168 /** |
| 3869 * The task descriptor describing this kind of task. | 4169 * The task descriptor describing this kind of task. |
| 3870 */ | 4170 */ |
| 3871 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4171 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3872 'ResolveInstanceFieldsInUnitTask', | 4172 'ResolveInstanceFieldsInUnitTask', |
| 3873 createTask, | 4173 createTask, |
| 3874 buildInputs, | 4174 buildInputs, |
| 3875 <ResultDescriptor>[RESOLVED_UNIT7]); | 4175 <ResultDescriptor>[RESOLVED_UNIT8]); |
| 3876 | 4176 |
| 3877 /** | 4177 /** |
| 3878 * Initialize a newly created task to build a library element for the given | 4178 * Initialize a newly created task to build a library element for the given |
| 3879 * [unit] in the given [context]. | 4179 * [unit] in the given [context]. |
| 3880 */ | 4180 */ |
| 3881 ResolveInstanceFieldsInUnitTask( | 4181 ResolveInstanceFieldsInUnitTask( |
| 3882 InternalAnalysisContext context, LibrarySpecificUnit unit) | 4182 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 3883 : super(context, unit); | 4183 : super(context, unit); |
| 3884 | 4184 |
| 3885 @override | 4185 @override |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3913 libraryElement, | 4213 libraryElement, |
| 3914 unitElement.source, | 4214 unitElement.source, |
| 3915 typeProvider, | 4215 typeProvider, |
| 3916 AnalysisErrorListener.NULL_LISTENER, | 4216 AnalysisErrorListener.NULL_LISTENER, |
| 3917 inheritanceManager: inheritanceManager); | 4217 inheritanceManager: inheritanceManager); |
| 3918 unit.accept(visitor); | 4218 unit.accept(visitor); |
| 3919 } | 4219 } |
| 3920 // | 4220 // |
| 3921 // Record outputs. | 4221 // Record outputs. |
| 3922 // | 4222 // |
| 3923 outputs[RESOLVED_UNIT7] = unit; | 4223 outputs[RESOLVED_UNIT8] = unit; |
| 3924 } | 4224 } |
| 3925 | 4225 |
| 3926 /** | 4226 /** |
| 3927 * Return a map from the names of the inputs of this kind of task to the task | 4227 * Return a map from the names of the inputs of this kind of task to the task |
| 3928 * input descriptors describing those inputs for a task with the given | 4228 * input descriptors describing those inputs for a task with the given |
| 3929 * [libSource]. | 4229 * [libSource]. |
| 3930 */ | 4230 */ |
| 3931 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4231 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3932 LibrarySpecificUnit unit = target; | 4232 LibrarySpecificUnit unit = target; |
| 3933 return <String, TaskInput>{ | 4233 return <String, TaskInput>{ |
| 3934 UNIT_INPUT: RESOLVED_UNIT6.of(unit), | 4234 UNIT_INPUT: RESOLVED_UNIT7.of(unit), |
| 3935 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), | 4235 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), |
| 3936 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 4236 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 3937 // In strong mode, add additional dependencies to enforce inference | 4237 // In strong mode, add additional dependencies to enforce inference |
| 3938 // ordering. | 4238 // ordering. |
| 3939 | 4239 |
| 3940 // Require that static variable inference be complete for all units in | 4240 // Require that static variable inference be complete for all units in |
| 3941 // the current library cycle. | 4241 // the current library cycle. |
| 3942 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( | 4242 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( |
| 3943 (CompilationUnitElementImpl unit) => RESOLVED_UNIT6 | 4243 (CompilationUnitElementImpl unit) => RESOLVED_UNIT7 |
| 3944 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))), | 4244 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))), |
| 3945 // Require that full inference be complete for all dependencies of the | 4245 // Require that full inference be complete for all dependencies of the |
| 3946 // current library cycle. | 4246 // current library cycle. |
| 3947 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 4247 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 3948 (CompilationUnitElementImpl unit) => RESOLVED_UNIT8 | 4248 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 |
| 3949 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) | 4249 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) |
| 3950 }; | 4250 }; |
| 3951 } | 4251 } |
| 3952 | 4252 |
| 3953 /** | 4253 /** |
| 3954 * Create a [ResolveInstanceFieldsInUnitTask] based on the given [target] in | 4254 * Create a [ResolveInstanceFieldsInUnitTask] based on the given [target] in |
| 3955 * the given [context]. | 4255 * the given [context]. |
| 3956 */ | 4256 */ |
| 3957 static ResolveInstanceFieldsInUnitTask createTask( | 4257 static ResolveInstanceFieldsInUnitTask createTask( |
| 3958 AnalysisContext context, AnalysisTarget target) { | 4258 AnalysisContext context, AnalysisTarget target) { |
| 3959 return new ResolveInstanceFieldsInUnitTask(context, target); | 4259 return new ResolveInstanceFieldsInUnitTask(context, target); |
| 3960 } | 4260 } |
| 3961 } | 4261 } |
| 3962 | 4262 |
| 3963 /** | 4263 /** |
| 3964 * A task that finishes resolution by requesting [RESOLVED_UNIT9] for every | 4264 * A task that finishes resolution by requesting [RESOLVED_UNIT10] for every |
| 3965 * unit in the libraries closure and produces [LIBRARY_ELEMENT]. | 4265 * unit in the libraries closure and produces [LIBRARY_ELEMENT]. |
| 3966 */ | 4266 */ |
| 3967 class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { | 4267 class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { |
| 3968 /** | 4268 /** |
| 3969 * The name of the [LIBRARY_ELEMENT5] input. | 4269 * The name of the [LIBRARY_ELEMENT5] input. |
| 3970 */ | 4270 */ |
| 3971 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4271 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 3972 | 4272 |
| 3973 /** | 4273 /** |
| 3974 * The name of the list of [RESOLVED_UNIT9] input. | 4274 * The name of the list of [RESOLVED_UNIT10] input. |
| 3975 */ | 4275 */ |
| 3976 static const String UNITS_INPUT = 'UNITS_INPUT'; | 4276 static const String UNITS_INPUT = 'UNITS_INPUT'; |
| 3977 | 4277 |
| 3978 /** | 4278 /** |
| 3979 * The task descriptor describing this kind of task. | 4279 * The task descriptor describing this kind of task. |
| 3980 */ | 4280 */ |
| 3981 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4281 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3982 'ResolveLibraryReferencesTask', | 4282 'ResolveLibraryReferencesTask', |
| 3983 createTask, | 4283 createTask, |
| 3984 buildInputs, | 4284 buildInputs, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4012 | 4312 |
| 4013 /** | 4313 /** |
| 4014 * Return a map from the names of the inputs of this kind of task to the task | 4314 * Return a map from the names of the inputs of this kind of task to the task |
| 4015 * input descriptors describing those inputs for a task with the | 4315 * input descriptors describing those inputs for a task with the |
| 4016 * given [target]. | 4316 * given [target]. |
| 4017 */ | 4317 */ |
| 4018 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4318 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4019 Source source = target; | 4319 Source source = target; |
| 4020 return <String, TaskInput>{ | 4320 return <String, TaskInput>{ |
| 4021 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source), | 4321 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source), |
| 4022 UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT9), | 4322 UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT10), |
| 4023 'thisLibraryClosureIsReady': READY_RESOLVED_UNIT9.of(source), | 4323 'thisLibraryClosureIsReady': READY_RESOLVED_UNIT10.of(source), |
| 4024 }; | 4324 }; |
| 4025 } | 4325 } |
| 4026 | 4326 |
| 4027 /** | 4327 /** |
| 4028 * Create a [ResolveLibraryReferencesTask] based on the given [target] in | 4328 * Create a [ResolveLibraryReferencesTask] based on the given [target] in |
| 4029 * the given [context]. | 4329 * the given [context]. |
| 4030 */ | 4330 */ |
| 4031 static ResolveLibraryReferencesTask createTask( | 4331 static ResolveLibraryReferencesTask createTask( |
| 4032 AnalysisContext context, AnalysisTarget target) { | 4332 AnalysisContext context, AnalysisTarget target) { |
| 4033 return new ResolveLibraryReferencesTask(context, target); | 4333 return new ResolveLibraryReferencesTask(context, target); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4116 * The name of the input whose value is the defining [LIBRARY_ELEMENT5]. | 4416 * The name of the input whose value is the defining [LIBRARY_ELEMENT5]. |
| 4117 */ | 4417 */ |
| 4118 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4418 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4119 | 4419 |
| 4120 /** | 4420 /** |
| 4121 * The name of the [TYPE_PROVIDER] input. | 4421 * The name of the [TYPE_PROVIDER] input. |
| 4122 */ | 4422 */ |
| 4123 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 4423 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 4124 | 4424 |
| 4125 /** | 4425 /** |
| 4126 * The name of the [RESOLVED_UNIT8] input. | 4426 * The name of the [RESOLVED_UNIT9] input. |
| 4127 */ | 4427 */ |
| 4128 static const String UNIT_INPUT = 'UNIT_INPUT'; | 4428 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 4129 | 4429 |
| 4130 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4430 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4131 'ResolveUnitTask', | 4431 'ResolveUnitTask', |
| 4132 createTask, | 4432 createTask, |
| 4133 buildInputs, | 4433 buildInputs, |
| 4134 <ResultDescriptor>[RESOLVE_UNIT_ERRORS, RESOLVED_UNIT9]); | 4434 <ResultDescriptor>[RESOLVE_UNIT_ERRORS, RESOLVED_UNIT10]); |
| 4135 | 4435 |
| 4136 ResolveUnitTask( | 4436 ResolveUnitTask( |
| 4137 InternalAnalysisContext context, LibrarySpecificUnit compilationUnit) | 4437 InternalAnalysisContext context, LibrarySpecificUnit compilationUnit) |
| 4138 : super(context, compilationUnit); | 4438 : super(context, compilationUnit); |
| 4139 | 4439 |
| 4140 @override | 4440 @override |
| 4141 TaskDescriptor get descriptor => DESCRIPTOR; | 4441 TaskDescriptor get descriptor => DESCRIPTOR; |
| 4142 | 4442 |
| 4143 @override | 4443 @override |
| 4144 void internalPerform() { | 4444 void internalPerform() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4157 libraryElement, unitElement.source, typeProvider, errorListener); | 4457 libraryElement, unitElement.source, typeProvider, errorListener); |
| 4158 unit.accept(visitor); | 4458 unit.accept(visitor); |
| 4159 // | 4459 // |
| 4160 // Record outputs. | 4460 // Record outputs. |
| 4161 // | 4461 // |
| 4162 // TODO(brianwilkerson) This task modifies the element model (by copying the | 4462 // TODO(brianwilkerson) This task modifies the element model (by copying the |
| 4163 // AST's for constructor initializers into it) but does not produce an | 4463 // AST's for constructor initializers into it) but does not produce an |
| 4164 // updated version of the element model. | 4464 // updated version of the element model. |
| 4165 // | 4465 // |
| 4166 outputs[RESOLVE_UNIT_ERRORS] = errorListener.errors; | 4466 outputs[RESOLVE_UNIT_ERRORS] = errorListener.errors; |
| 4167 outputs[RESOLVED_UNIT9] = unit; | 4467 outputs[RESOLVED_UNIT10] = unit; |
| 4168 } | 4468 } |
| 4169 | 4469 |
| 4170 /** | 4470 /** |
| 4171 * Return a map from the names of the inputs of this kind of task to the task | 4471 * Return a map from the names of the inputs of this kind of task to the task |
| 4172 * input descriptors describing those inputs for a task with the given | 4472 * input descriptors describing those inputs for a task with the given |
| 4173 * [target]. | 4473 * [target]. |
| 4174 */ | 4474 */ |
| 4175 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4475 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4176 LibrarySpecificUnit unit = target; | 4476 LibrarySpecificUnit unit = target; |
| 4177 return <String, TaskInput>{ | 4477 return <String, TaskInput>{ |
| 4178 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), | 4478 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), |
| 4179 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 4479 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 4180 UNIT_INPUT: RESOLVED_UNIT8.of(unit), | 4480 UNIT_INPUT: RESOLVED_UNIT9.of(unit), |
| 4181 // In strong mode, add additional dependencies to enforce inference | 4481 // In strong mode, add additional dependencies to enforce inference |
| 4182 // ordering. | 4482 // ordering. |
| 4183 | 4483 |
| 4184 // Require that inference be complete for all units in the | 4484 // Require that inference be complete for all units in the |
| 4185 // current library cycle. | 4485 // current library cycle. |
| 4186 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( | 4486 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( |
| 4187 (CompilationUnitElementImpl unit) => RESOLVED_UNIT8 | 4487 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 |
| 4188 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) | 4488 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) |
| 4189 }; | 4489 }; |
| 4190 } | 4490 } |
| 4191 | 4491 |
| 4192 /** | 4492 /** |
| 4193 * Create a [ResolveUnitTask] based on the given [target] in | 4493 * Create a [ResolveUnitTask] based on the given [target] in |
| 4194 * the given [context]. | 4494 * the given [context]. |
| 4195 */ | 4495 */ |
| 4196 static ResolveUnitTask createTask( | 4496 static ResolveUnitTask createTask( |
| 4197 AnalysisContext context, AnalysisTarget target) { | 4497 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4486 return new ScanDartTask(context, target); | 4786 return new ScanDartTask(context, target); |
| 4487 } | 4787 } |
| 4488 } | 4788 } |
| 4489 | 4789 |
| 4490 /** | 4790 /** |
| 4491 * A task that builds [STRONG_MODE_ERRORS] for a unit. Also builds | 4791 * A task that builds [STRONG_MODE_ERRORS] for a unit. Also builds |
| 4492 * [RESOLVED_UNIT] for a unit. | 4792 * [RESOLVED_UNIT] for a unit. |
| 4493 */ | 4793 */ |
| 4494 class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask { | 4794 class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask { |
| 4495 /** | 4795 /** |
| 4496 * The name of the [RESOLVED_UNIT10] input. | 4796 * The name of the [RESOLVED_UNIT11] input. |
| 4497 */ | 4797 */ |
| 4498 static const String UNIT_INPUT = 'UNIT_INPUT'; | 4798 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 4499 | 4799 |
| 4500 /** | 4800 /** |
| 4501 * The name of the [TYPE_PROVIDER] input. | 4801 * The name of the [TYPE_PROVIDER] input. |
| 4502 */ | 4802 */ |
| 4503 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 4803 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 4504 | 4804 |
| 4505 /** | 4805 /** |
| 4506 * The task descriptor describing this kind of task. | 4806 * The task descriptor describing this kind of task. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4538 } | 4838 } |
| 4539 | 4839 |
| 4540 /** | 4840 /** |
| 4541 * Return a map from the names of the inputs of this kind of task to the task | 4841 * Return a map from the names of the inputs of this kind of task to the task |
| 4542 * input descriptors describing those inputs for a task with the | 4842 * input descriptors describing those inputs for a task with the |
| 4543 * given [target]. | 4843 * given [target]. |
| 4544 */ | 4844 */ |
| 4545 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4845 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4546 LibrarySpecificUnit unit = target; | 4846 LibrarySpecificUnit unit = target; |
| 4547 return <String, TaskInput>{ | 4847 return <String, TaskInput>{ |
| 4548 UNIT_INPUT: RESOLVED_UNIT10.of(unit), | 4848 UNIT_INPUT: RESOLVED_UNIT11.of(unit), |
| 4549 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 4849 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 4550 'thisLibraryClosureIsReady': READY_RESOLVED_UNIT10.of(unit.library), | 4850 'thisLibraryClosureIsReady': READY_RESOLVED_UNIT11.of(unit.library), |
| 4551 }; | 4851 }; |
| 4552 } | 4852 } |
| 4553 | 4853 |
| 4554 /** | 4854 /** |
| 4555 * Create a [StrongModeVerifyUnitTask] based on the given [target] in | 4855 * Create a [StrongModeVerifyUnitTask] based on the given [target] in |
| 4556 * the given [context]. | 4856 * the given [context]. |
| 4557 */ | 4857 */ |
| 4558 static StrongModeVerifyUnitTask createTask( | 4858 static StrongModeVerifyUnitTask createTask( |
| 4559 AnalysisContext context, AnalysisTarget target) { | 4859 AnalysisContext context, AnalysisTarget target) { |
| 4560 return new StrongModeVerifyUnitTask(context, target); | 4860 return new StrongModeVerifyUnitTask(context, target); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4786 | 5086 |
| 4787 @override | 5087 @override |
| 4788 bool moveNext() { | 5088 bool moveNext() { |
| 4789 if (_newSources.isEmpty) { | 5089 if (_newSources.isEmpty) { |
| 4790 return false; | 5090 return false; |
| 4791 } | 5091 } |
| 4792 currentTarget = _newSources.removeLast(); | 5092 currentTarget = _newSources.removeLast(); |
| 4793 return true; | 5093 return true; |
| 4794 } | 5094 } |
| 4795 } | 5095 } |
| OLD | NEW |