| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine; | 4 library engine; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'java_engine.dart'; | 7 import 'java_engine.dart'; |
| 8 import 'utilities_collection.dart'; | 8 import 'utilities_collection.dart'; |
| 9 import 'utilities_general.dart'; | 9 import 'utilities_general.dart'; |
| 10 import 'instrumentation.dart'; | 10 import 'instrumentation.dart'; |
| 11 import 'error.dart'; | 11 import 'error.dart'; |
| 12 import 'source.dart'; | 12 import 'source.dart'; |
| 13 import 'scanner.dart' show Token, Scanner, CharSequenceReader; | 13 import 'scanner.dart' show Token, Scanner, CharSequenceReader; |
| 14 import 'ast.dart'; | 14 import 'ast.dart'; |
| 15 import 'parser.dart' show Parser; | 15 import 'parser.dart' show Parser; |
| 16 import 'sdk.dart' show DartSdk; | 16 import 'sdk.dart' show DartSdk; |
| 17 import 'element.dart'; | 17 import 'element.dart'; |
| 18 import 'resolver.dart'; | 18 import 'resolver.dart'; |
| 19 import 'html.dart' show XmlTagNode, XmlAttributeNode, RecursiveXmlVisitor, HtmlS
canner, HtmlScanResult, HtmlParser, HtmlParseResult, HtmlUnit; | 19 import 'html.dart' show XmlTagNode, XmlAttributeNode, RecursiveXmlVisitor, HtmlS
canner, HtmlScanResult, HtmlParser, HtmlParseResult, HtmlScriptTagNode, HtmlUnit
; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the | 22 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the |
| 23 * functionality provided by the analysis engine. | 23 * functionality provided by the analysis engine. |
| 24 * | 24 * |
| 25 * @coverage dart.engine | 25 * @coverage dart.engine |
| 26 */ | 26 */ |
| 27 class AnalysisEngine { | 27 class AnalysisEngine { |
| 28 /** | 28 /** |
| 29 * The suffix used for Dart source files. | 29 * The suffix used for Dart source files. |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 */ | 704 */ |
| 705 bool get dart2jsHint; | 705 bool get dart2jsHint; |
| 706 | 706 |
| 707 /** | 707 /** |
| 708 * Return `true` if analysis is to generate hint results (e.g. type inference
based | 708 * Return `true` if analysis is to generate hint results (e.g. type inference
based |
| 709 * information and pub best practices). | 709 * information and pub best practices). |
| 710 * | 710 * |
| 711 * @return `true` if analysis is to generate hint results | 711 * @return `true` if analysis is to generate hint results |
| 712 */ | 712 */ |
| 713 bool get hint; | 713 bool get hint; |
| 714 | |
| 715 /** | |
| 716 * Return `true` if analysis is to use strict mode. In strict mode, error repo
rting is based | |
| 717 * exclusively on the static type information. | |
| 718 * | |
| 719 * @return `true` if analysis is to use strict mode | |
| 720 */ | |
| 721 bool get strictMode; | |
| 722 } | 714 } |
| 723 | 715 |
| 724 /** | 716 /** |
| 725 * Instances of the class `AnalysisResult` | 717 * Instances of the class `AnalysisResult` |
| 726 */ | 718 */ |
| 727 class AnalysisResult { | 719 class AnalysisResult { |
| 728 /** | 720 /** |
| 729 * The change notices associated with this result, or `null` if there were no
changes and | 721 * The change notices associated with this result, or `null` if there were no
changes and |
| 730 * there is no more work to be done. | 722 * there is no more work to be done. |
| 731 */ | 723 */ |
| (...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 */ | 2350 */ |
| 2359 abstract class HtmlEntry implements SourceEntry { | 2351 abstract class HtmlEntry implements SourceEntry { |
| 2360 /** | 2352 /** |
| 2361 * The data descriptor representing the HTML element. | 2353 * The data descriptor representing the HTML element. |
| 2362 */ | 2354 */ |
| 2363 static final DataDescriptor<HtmlElement> ELEMENT = new DataDescriptor<HtmlElem
ent>("HtmlEntry.ELEMENT"); | 2355 static final DataDescriptor<HtmlElement> ELEMENT = new DataDescriptor<HtmlElem
ent>("HtmlEntry.ELEMENT"); |
| 2364 | 2356 |
| 2365 /** | 2357 /** |
| 2366 * The data descriptor representing the hints resulting from auditing the sour
ce. | 2358 * The data descriptor representing the hints resulting from auditing the sour
ce. |
| 2367 */ | 2359 */ |
| 2368 static final DataDescriptor<List<AnalysisError>> HINTS = new DataDescriptor<Li
st<AnalysisError>>("DartEntry.HINTS"); | 2360 static final DataDescriptor<List<AnalysisError>> HINTS = new DataDescriptor<Li
st<AnalysisError>>("HtmlEntry.HINTS"); |
| 2361 |
| 2362 /** |
| 2363 * The data descriptor representing the errors resulting from parsing the sour
ce. |
| 2364 */ |
| 2365 static final DataDescriptor<List<AnalysisError>> PARSE_ERRORS = new DataDescri
ptor<List<AnalysisError>>("HtmlEntry.PARSE_ERRORS"); |
| 2369 | 2366 |
| 2370 /** | 2367 /** |
| 2371 * The data descriptor representing the parsed AST structure. | 2368 * The data descriptor representing the parsed AST structure. |
| 2372 */ | 2369 */ |
| 2373 static final DataDescriptor<HtmlUnit> PARSED_UNIT = new DataDescriptor<HtmlUni
t>("HtmlEntry.PARSED_UNIT"); | 2370 static final DataDescriptor<HtmlUnit> PARSED_UNIT = new DataDescriptor<HtmlUni
t>("HtmlEntry.PARSED_UNIT"); |
| 2374 | 2371 |
| 2375 /** | 2372 /** |
| 2376 * The data descriptor representing the list of referenced libraries. | 2373 * The data descriptor representing the list of referenced libraries. |
| 2377 */ | 2374 */ |
| 2378 static final DataDescriptor<List<Source>> REFERENCED_LIBRARIES = new DataDescr
iptor<List<Source>>("HtmlEntry.REFERENCED_LIBRARIES"); | 2375 static final DataDescriptor<List<Source>> REFERENCED_LIBRARIES = new DataDescr
iptor<List<Source>>("HtmlEntry.REFERENCED_LIBRARIES"); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2402 * The state of the cached parsed (but not resolved) HTML unit. | 2399 * The state of the cached parsed (but not resolved) HTML unit. |
| 2403 */ | 2400 */ |
| 2404 CacheState _parsedUnitState = CacheState.INVALID; | 2401 CacheState _parsedUnitState = CacheState.INVALID; |
| 2405 | 2402 |
| 2406 /** | 2403 /** |
| 2407 * The parsed HTML unit, or `null` if the parsed HTML unit is not currently ca
ched. | 2404 * The parsed HTML unit, or `null` if the parsed HTML unit is not currently ca
ched. |
| 2408 */ | 2405 */ |
| 2409 HtmlUnit _parsedUnit; | 2406 HtmlUnit _parsedUnit; |
| 2410 | 2407 |
| 2411 /** | 2408 /** |
| 2409 * The state of the cached parse errors. |
| 2410 */ |
| 2411 CacheState _parseErrorsState = CacheState.INVALID; |
| 2412 |
| 2413 /** |
| 2414 * The errors produced while scanning and parsing the HTML, or `null` if the e
rrors are not |
| 2415 * currently cached. |
| 2416 */ |
| 2417 List<AnalysisError> _parseErrors = AnalysisError.NO_ERRORS; |
| 2418 |
| 2419 /** |
| 2412 * The state of the cached resolution errors. | 2420 * The state of the cached resolution errors. |
| 2413 */ | 2421 */ |
| 2414 CacheState _resolutionErrorsState = CacheState.INVALID; | 2422 CacheState _resolutionErrorsState = CacheState.INVALID; |
| 2415 | 2423 |
| 2416 /** | 2424 /** |
| 2417 * The errors produced while resolving the compilation unit, or `null` if the
errors are not | 2425 * The errors produced while resolving the HTML, or `null` if the errors are n
ot currently |
| 2418 * currently cached. | 2426 * cached. |
| 2419 */ | 2427 */ |
| 2420 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 2428 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2421 | 2429 |
| 2422 /** | 2430 /** |
| 2423 * The state of the cached list of referenced libraries. | 2431 * The state of the cached list of referenced libraries. |
| 2424 */ | 2432 */ |
| 2425 CacheState _referencedLibrariesState = CacheState.INVALID; | 2433 CacheState _referencedLibrariesState = CacheState.INVALID; |
| 2426 | 2434 |
| 2427 /** | 2435 /** |
| 2428 * The list of libraries referenced in the HTML, or `null` if the list is not
currently | 2436 * The list of libraries referenced in the HTML, or `null` if the list is not
currently |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2446 CacheState _hintsState = CacheState.INVALID; | 2454 CacheState _hintsState = CacheState.INVALID; |
| 2447 | 2455 |
| 2448 /** | 2456 /** |
| 2449 * The hints produced while auditing the compilation unit, or an empty array i
f the hints are not | 2457 * The hints produced while auditing the compilation unit, or an empty array i
f the hints are not |
| 2450 * currently cached. | 2458 * currently cached. |
| 2451 */ | 2459 */ |
| 2452 List<AnalysisError> _hints = AnalysisError.NO_ERRORS; | 2460 List<AnalysisError> _hints = AnalysisError.NO_ERRORS; |
| 2453 | 2461 |
| 2454 List<AnalysisError> get allErrors { | 2462 List<AnalysisError> get allErrors { |
| 2455 List<AnalysisError> errors = new List<AnalysisError>(); | 2463 List<AnalysisError> errors = new List<AnalysisError>(); |
| 2464 for (AnalysisError error in _parseErrors) { |
| 2465 errors.add(error); |
| 2466 } |
| 2456 for (AnalysisError error in _resolutionErrors) { | 2467 for (AnalysisError error in _resolutionErrors) { |
| 2457 errors.add(error); | 2468 errors.add(error); |
| 2458 } | 2469 } |
| 2459 for (AnalysisError error in _hints) { | 2470 for (AnalysisError error in _hints) { |
| 2460 errors.add(error); | 2471 errors.add(error); |
| 2461 } | 2472 } |
| 2462 if (errors.length == 0) { | 2473 if (errors.length == 0) { |
| 2463 return AnalysisError.NO_ERRORS; | 2474 return AnalysisError.NO_ERRORS; |
| 2464 } | 2475 } |
| 2465 return new List.from(errors); | 2476 return new List.from(errors); |
| 2466 } | 2477 } |
| 2467 | 2478 |
| 2468 SourceKind get kind => SourceKind.HTML; | 2479 SourceKind get kind => SourceKind.HTML; |
| 2469 | 2480 |
| 2470 CacheState getState(DataDescriptor descriptor) { | 2481 CacheState getState(DataDescriptor descriptor) { |
| 2471 if (identical(descriptor, HtmlEntry.ELEMENT)) { | 2482 if (identical(descriptor, HtmlEntry.ELEMENT)) { |
| 2472 return _elementState; | 2483 return _elementState; |
| 2484 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { |
| 2485 return _parseErrorsState; |
| 2473 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { | 2486 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { |
| 2474 return _parsedUnitState; | 2487 return _parsedUnitState; |
| 2475 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { | 2488 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { |
| 2476 return _referencedLibrariesState; | 2489 return _referencedLibrariesState; |
| 2477 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { | 2490 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { |
| 2478 return _resolutionErrorsState; | 2491 return _resolutionErrorsState; |
| 2479 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 2492 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 2480 return _hintsState; | 2493 return _hintsState; |
| 2481 } | 2494 } |
| 2482 return super.getState(descriptor); | 2495 return super.getState(descriptor); |
| 2483 } | 2496 } |
| 2484 | 2497 |
| 2485 Object getValue(DataDescriptor descriptor) { | 2498 Object getValue(DataDescriptor descriptor) { |
| 2486 if (identical(descriptor, HtmlEntry.ELEMENT)) { | 2499 if (identical(descriptor, HtmlEntry.ELEMENT)) { |
| 2487 return _element as Object; | 2500 return _element as Object; |
| 2501 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { |
| 2502 return _parseErrors as Object; |
| 2488 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { | 2503 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { |
| 2489 return _parsedUnit as Object; | 2504 return _parsedUnit as Object; |
| 2490 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { | 2505 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { |
| 2491 return _referencedLibraries as Object; | 2506 return _referencedLibraries as Object; |
| 2492 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { | 2507 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { |
| 2493 return _resolutionErrors as Object; | 2508 return _resolutionErrors as Object; |
| 2494 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 2509 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 2495 return _hints as Object; | 2510 return _hints as Object; |
| 2496 } | 2511 } |
| 2497 return super.getValue(descriptor); | 2512 return super.getValue(descriptor); |
| 2498 } | 2513 } |
| 2499 | 2514 |
| 2500 HtmlEntryImpl get writableCopy { | 2515 HtmlEntryImpl get writableCopy { |
| 2501 HtmlEntryImpl copy = new HtmlEntryImpl(); | 2516 HtmlEntryImpl copy = new HtmlEntryImpl(); |
| 2502 copy.copyFrom(this); | 2517 copy.copyFrom(this); |
| 2503 return copy; | 2518 return copy; |
| 2504 } | 2519 } |
| 2505 | 2520 |
| 2506 /** | 2521 /** |
| 2507 * Invalidate all of the information associated with the HTML file. | 2522 * Invalidate all of the information associated with the HTML file. |
| 2508 */ | 2523 */ |
| 2509 void invalidateAllInformation() { | 2524 void invalidateAllInformation() { |
| 2510 setState(SourceEntry.LINE_INFO, CacheState.INVALID); | 2525 setState(SourceEntry.LINE_INFO, CacheState.INVALID); |
| 2526 _parseErrors = AnalysisError.NO_ERRORS; |
| 2527 _parseErrorsState = CacheState.INVALID; |
| 2511 _parsedUnit = null; | 2528 _parsedUnit = null; |
| 2512 _parsedUnitState = CacheState.INVALID; | 2529 _parsedUnitState = CacheState.INVALID; |
| 2513 _referencedLibraries = Source.EMPTY_ARRAY; | 2530 _referencedLibraries = Source.EMPTY_ARRAY; |
| 2514 _referencedLibrariesState = CacheState.INVALID; | 2531 _referencedLibrariesState = CacheState.INVALID; |
| 2515 invalidateAllResolutionInformation(); | 2532 invalidateAllResolutionInformation(); |
| 2516 } | 2533 } |
| 2517 | 2534 |
| 2518 /** | 2535 /** |
| 2519 * Invalidate all of the resolution information associated with the HTML file. | 2536 * Invalidate all of the resolution information associated with the HTML file. |
| 2520 */ | 2537 */ |
| 2521 void invalidateAllResolutionInformation() { | 2538 void invalidateAllResolutionInformation() { |
| 2522 _element = null; | 2539 _element = null; |
| 2523 _elementState = CacheState.INVALID; | 2540 _elementState = CacheState.INVALID; |
| 2524 _resolutionErrors = AnalysisError.NO_ERRORS; | 2541 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2525 _resolutionErrorsState = CacheState.INVALID; | 2542 _resolutionErrorsState = CacheState.INVALID; |
| 2526 _hints = AnalysisError.NO_ERRORS; | 2543 _hints = AnalysisError.NO_ERRORS; |
| 2527 _hintsState = CacheState.INVALID; | 2544 _hintsState = CacheState.INVALID; |
| 2528 } | 2545 } |
| 2529 | 2546 |
| 2530 /** | 2547 /** |
| 2531 * Record that an error was encountered while attempting to parse the source a
ssociated with this | 2548 * Record that an error was encountered while attempting to parse the source a
ssociated with this |
| 2532 * entry. | 2549 * entry. |
| 2533 */ | 2550 */ |
| 2534 void recordParseError() { | 2551 void recordParseError() { |
| 2535 setState(SourceEntry.LINE_INFO, CacheState.ERROR); | 2552 setState(SourceEntry.LINE_INFO, CacheState.ERROR); |
| 2553 setState(HtmlEntry.PARSE_ERRORS, CacheState.ERROR); |
| 2536 setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR); | 2554 setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR); |
| 2537 setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR); | 2555 setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR); |
| 2538 recordResolutionError(); | 2556 recordResolutionError(); |
| 2539 } | 2557 } |
| 2540 | 2558 |
| 2541 /** | 2559 /** |
| 2542 * Record that an error was encountered while attempting to resolve the source
associated with | 2560 * Record that an error was encountered while attempting to resolve the source
associated with |
| 2543 * this entry. | 2561 * this entry. |
| 2544 */ | 2562 */ |
| 2545 void recordResolutionError() { | 2563 void recordResolutionError() { |
| 2546 setState(HtmlEntry.ELEMENT, CacheState.ERROR); | 2564 setState(HtmlEntry.ELEMENT, CacheState.ERROR); |
| 2547 setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR); | 2565 setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR); |
| 2548 setState(HtmlEntry.HINTS, CacheState.ERROR); | 2566 setState(HtmlEntry.HINTS, CacheState.ERROR); |
| 2549 } | 2567 } |
| 2550 | 2568 |
| 2551 void setState(DataDescriptor descriptor, CacheState state) { | 2569 void setState(DataDescriptor descriptor, CacheState state) { |
| 2552 if (identical(descriptor, HtmlEntry.ELEMENT)) { | 2570 if (identical(descriptor, HtmlEntry.ELEMENT)) { |
| 2553 _element = updatedValue(state, _element, null); | 2571 _element = updatedValue(state, _element, null); |
| 2554 _elementState = state; | 2572 _elementState = state; |
| 2573 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { |
| 2574 _parseErrors = updatedValue(state, _parseErrors, null); |
| 2575 _parseErrorsState = state; |
| 2555 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { | 2576 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { |
| 2556 _parsedUnit = updatedValue(state, _parsedUnit, null); | 2577 _parsedUnit = updatedValue(state, _parsedUnit, null); |
| 2557 _parsedUnitState = state; | 2578 _parsedUnitState = state; |
| 2558 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { | 2579 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { |
| 2559 _referencedLibraries = updatedValue(state, _referencedLibraries, Source.EM
PTY_ARRAY); | 2580 _referencedLibraries = updatedValue(state, _referencedLibraries, Source.EM
PTY_ARRAY); |
| 2560 _referencedLibrariesState = state; | 2581 _referencedLibrariesState = state; |
| 2561 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { | 2582 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { |
| 2562 _resolutionErrors = updatedValue(state, _resolutionErrors, AnalysisError.N
O_ERRORS); | 2583 _resolutionErrors = updatedValue(state, _resolutionErrors, AnalysisError.N
O_ERRORS); |
| 2563 _resolutionErrorsState = state; | 2584 _resolutionErrorsState = state; |
| 2564 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 2585 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 2565 _hints = updatedValue(state, _hints, AnalysisError.NO_ERRORS); | 2586 _hints = updatedValue(state, _hints, AnalysisError.NO_ERRORS); |
| 2566 _hintsState = state; | 2587 _hintsState = state; |
| 2567 } else { | 2588 } else { |
| 2568 super.setState(descriptor, state); | 2589 super.setState(descriptor, state); |
| 2569 } | 2590 } |
| 2570 } | 2591 } |
| 2571 | 2592 |
| 2572 void setValue(DataDescriptor descriptor, Object value) { | 2593 void setValue(DataDescriptor descriptor, Object value) { |
| 2573 if (identical(descriptor, HtmlEntry.ELEMENT)) { | 2594 if (identical(descriptor, HtmlEntry.ELEMENT)) { |
| 2574 _element = value as HtmlElement; | 2595 _element = value as HtmlElement; |
| 2575 _elementState = CacheState.VALID; | 2596 _elementState = CacheState.VALID; |
| 2597 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { |
| 2598 _parseErrors = value as List<AnalysisError>; |
| 2599 _parseErrorsState = CacheState.VALID; |
| 2576 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { | 2600 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { |
| 2577 _parsedUnit = value as HtmlUnit; | 2601 _parsedUnit = value as HtmlUnit; |
| 2578 _parsedUnitState = CacheState.VALID; | 2602 _parsedUnitState = CacheState.VALID; |
| 2579 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { | 2603 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { |
| 2580 _referencedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List
<Source>); | 2604 _referencedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List
<Source>); |
| 2581 _referencedLibrariesState = CacheState.VALID; | 2605 _referencedLibrariesState = CacheState.VALID; |
| 2582 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { | 2606 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { |
| 2583 _resolutionErrors = value as List<AnalysisError>; | 2607 _resolutionErrors = value as List<AnalysisError>; |
| 2584 _resolutionErrorsState = CacheState.VALID; | 2608 _resolutionErrorsState = CacheState.VALID; |
| 2585 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 2609 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 2586 _hints = value as List<AnalysisError>; | 2610 _hints = value as List<AnalysisError>; |
| 2587 _hintsState = CacheState.VALID; | 2611 _hintsState = CacheState.VALID; |
| 2588 } else { | 2612 } else { |
| 2589 super.setValue(descriptor, value); | 2613 super.setValue(descriptor, value); |
| 2590 } | 2614 } |
| 2591 } | 2615 } |
| 2592 | 2616 |
| 2593 void copyFrom(SourceEntryImpl entry) { | 2617 void copyFrom(SourceEntryImpl entry) { |
| 2594 super.copyFrom(entry); | 2618 super.copyFrom(entry); |
| 2595 HtmlEntryImpl other = entry as HtmlEntryImpl; | 2619 HtmlEntryImpl other = entry as HtmlEntryImpl; |
| 2620 _parseErrorsState = other._parseErrorsState; |
| 2621 _parseErrors = other._parseErrors; |
| 2596 _parsedUnitState = other._parsedUnitState; | 2622 _parsedUnitState = other._parsedUnitState; |
| 2597 _parsedUnit = other._parsedUnit; | 2623 _parsedUnit = other._parsedUnit; |
| 2598 _referencedLibrariesState = other._referencedLibrariesState; | 2624 _referencedLibrariesState = other._referencedLibrariesState; |
| 2599 _referencedLibraries = other._referencedLibraries; | 2625 _referencedLibraries = other._referencedLibraries; |
| 2600 _resolutionErrors = other._resolutionErrors; | 2626 _resolutionErrors = other._resolutionErrors; |
| 2601 _resolutionErrorsState = other._resolutionErrorsState; | 2627 _resolutionErrorsState = other._resolutionErrorsState; |
| 2602 _elementState = other._elementState; | 2628 _elementState = other._elementState; |
| 2603 _element = other._element; | 2629 _element = other._element; |
| 2604 _hints = other._hints; | 2630 _hints = other._hints; |
| 2605 _hintsState = other._hintsState; | 2631 _hintsState = other._hintsState; |
| 2606 } | 2632 } |
| 2607 | 2633 |
| 2608 void writeOn(JavaStringBuilder builder) { | 2634 void writeOn(JavaStringBuilder builder) { |
| 2609 builder.append("Html: "); | 2635 builder.append("Html: "); |
| 2610 super.writeOn(builder); | 2636 super.writeOn(builder); |
| 2637 builder.append("; parseErrors = "); |
| 2638 builder.append(_parseErrorsState); |
| 2611 builder.append("; parsedUnit = "); | 2639 builder.append("; parsedUnit = "); |
| 2612 builder.append(_parsedUnitState); | 2640 builder.append(_parsedUnitState); |
| 2613 builder.append("; resolutionErrors = "); | 2641 builder.append("; resolutionErrors = "); |
| 2614 builder.append(_resolutionErrorsState); | 2642 builder.append(_resolutionErrorsState); |
| 2615 builder.append("; referencedLibraries = "); | 2643 builder.append("; referencedLibraries = "); |
| 2616 builder.append(_referencedLibrariesState); | 2644 builder.append(_referencedLibrariesState); |
| 2617 builder.append("; element = "); | 2645 builder.append("; element = "); |
| 2618 builder.append(_elementState); | 2646 builder.append(_elementState); |
| 2619 } | 2647 } |
| 2620 } | 2648 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2893 String rowName = rowDesc.toString(); | 2921 String rowName = rowDesc.toString(); |
| 2894 AnalysisContentStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys
isContentStatisticsImpl_CacheRowImpl; | 2922 AnalysisContentStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys
isContentStatisticsImpl_CacheRowImpl; |
| 2895 if (row == null) { | 2923 if (row == null) { |
| 2896 row = new AnalysisContentStatisticsImpl_CacheRowImpl(rowName); | 2924 row = new AnalysisContentStatisticsImpl_CacheRowImpl(rowName); |
| 2897 _dataMap[rowName] = row; | 2925 _dataMap[rowName] = row; |
| 2898 } | 2926 } |
| 2899 row.incState(state); | 2927 row.incState(state); |
| 2900 if (identical(state, CacheState.ERROR)) { | 2928 if (identical(state, CacheState.ERROR)) { |
| 2901 AnalysisException exception = dartEntry.exception; | 2929 AnalysisException exception = dartEntry.exception; |
| 2902 if (exception != null) { | 2930 if (exception != null) { |
| 2903 javaSetAdd(_exceptions, exception); | 2931 _exceptions.add(exception); |
| 2904 } | 2932 } |
| 2905 } | 2933 } |
| 2906 } | 2934 } |
| 2907 } | 2935 } |
| 2908 | 2936 |
| 2909 class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStati
stics_CacheRow { | 2937 class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStati
stics_CacheRow { |
| 2910 String _name; | 2938 String _name; |
| 2911 | 2939 |
| 2912 int _errorCount = 0; | 2940 int _errorCount = 0; |
| 2913 | 2941 |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3642 _cache.maxCacheSize = cacheSize; | 3670 _cache.maxCacheSize = cacheSize; |
| 3643 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; | 3671 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; |
| 3644 if (_priorityOrder.length > maxPriorityOrderSize) { | 3672 if (_priorityOrder.length > maxPriorityOrderSize) { |
| 3645 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize)
; | 3673 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize)
; |
| 3646 JavaSystem.arraycopy(_priorityOrder, 0, newPriorityOrder, 0, maxPriori
tyOrderSize); | 3674 JavaSystem.arraycopy(_priorityOrder, 0, newPriorityOrder, 0, maxPriori
tyOrderSize); |
| 3647 _priorityOrder = newPriorityOrder; | 3675 _priorityOrder = newPriorityOrder; |
| 3648 } | 3676 } |
| 3649 } | 3677 } |
| 3650 this._options.dart2jsHint = options.dart2jsHint; | 3678 this._options.dart2jsHint = options.dart2jsHint; |
| 3651 this._options.hint = options.hint; | 3679 this._options.hint = options.hint; |
| 3652 this._options.strictMode = options.strictMode; | |
| 3653 if (needsRecompute) { | 3680 if (needsRecompute) { |
| 3654 invalidateAllResolutionInformation(); | 3681 invalidateAllResolutionInformation(); |
| 3655 } | 3682 } |
| 3656 } | 3683 } |
| 3657 } | 3684 } |
| 3658 | 3685 |
| 3659 void set analysisPriorityOrder(List<Source> sources) { | 3686 void set analysisPriorityOrder(List<Source> sources) { |
| 3660 { | 3687 { |
| 3661 if (sources == null || sources.isEmpty) { | 3688 if (sources == null || sources.isEmpty) { |
| 3662 _priorityOrder = Source.EMPTY_ARRAY; | 3689 _priorityOrder = Source.EMPTY_ARRAY; |
| 3663 } else { | 3690 } else { |
| 3664 while (sources.remove(null)) { | 3691 while (sources.remove(null)) { |
| 3665 } | 3692 } |
| 3666 if (sources.isEmpty) { | 3693 if (sources.isEmpty) { |
| 3667 _priorityOrder = Source.EMPTY_ARRAY; | 3694 _priorityOrder = Source.EMPTY_ARRAY; |
| 3668 } | 3695 } |
| 3669 int count = Math.min(sources.length, _options.cacheSize - _PRIORITY_ORDE
R_SIZE_DELTA); | 3696 int count = Math.min(sources.length, _options.cacheSize - _PRIORITY_ORDE
R_SIZE_DELTA); |
| 3670 _priorityOrder = new List<Source>(count); | 3697 _priorityOrder = new List<Source>(count); |
| 3671 for (int i = 0; i < count; i++) { | 3698 for (int i = 0; i < count; i++) { |
| 3672 _priorityOrder[i] = sources[i]; | 3699 _priorityOrder[i] = sources[i]; |
| 3673 } | 3700 } |
| 3674 } | 3701 } |
| 3675 } | 3702 } |
| 3676 } | 3703 } |
| 3677 | 3704 |
| 3678 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { | 3705 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { |
| 3679 { | 3706 { |
| 3680 String originalContents = _sourceFactory.setContents(source, contents); | 3707 String originalContents = _sourceFactory.setContents(source, contents); |
| 3681 if (originalContents == null) { | 3708 if (contents != null) { |
| 3682 if (contents != null) { | 3709 if (contents != originalContents) { |
| 3683 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_increment
alAnalysisCache, source, originalContents, contents, offset, oldLength, newLengt
h, getReadableSourceEntry(source)); | 3710 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_increment
alAnalysisCache, source, originalContents, contents, offset, oldLength, newLengt
h, getReadableSourceEntry(source)); |
| 3684 sourceChanged(source); | 3711 sourceChanged(source); |
| 3685 } | 3712 } |
| 3686 } else if (originalContents != contents) { | 3713 } else if (originalContents != null) { |
| 3687 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_incremental
AnalysisCache, source, originalContents, contents, offset, oldLength, newLength,
getReadableSourceEntry(source)); | 3714 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA
nalysisCache, source); |
| 3688 sourceChanged(source); | 3715 sourceChanged(source); |
| 3689 } else if (contents == null) { | |
| 3690 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA
nalysisCache, source); | |
| 3691 } | 3716 } |
| 3692 } | 3717 } |
| 3693 } | 3718 } |
| 3694 | 3719 |
| 3695 void setContents(Source source, String contents) { | 3720 void setContents(Source source, String contents) { |
| 3696 { | 3721 { |
| 3697 String originalContents = _sourceFactory.setContents(source, contents); | 3722 String originalContents = _sourceFactory.setContents(source, contents); |
| 3698 if (originalContents == null) { | 3723 if (contents != null) { |
| 3699 if (contents != null) { | 3724 if (contents != originalContents) { |
| 3725 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementa
lAnalysisCache, source); |
| 3700 sourceChanged(source); | 3726 sourceChanged(source); |
| 3701 } | 3727 } |
| 3702 } else if (originalContents != contents) { | 3728 } else if (originalContents != null) { |
| 3729 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA
nalysisCache, source); |
| 3703 sourceChanged(source); | 3730 sourceChanged(source); |
| 3704 } | 3731 } |
| 3705 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalAna
lysisCache, source); | |
| 3706 } | 3732 } |
| 3707 } | 3733 } |
| 3708 | 3734 |
| 3709 void set sourceFactory(SourceFactory factory) { | 3735 void set sourceFactory(SourceFactory factory) { |
| 3710 { | 3736 { |
| 3711 if (identical(_sourceFactory, factory)) { | 3737 if (identical(_sourceFactory, factory)) { |
| 3712 return; | 3738 return; |
| 3713 } else if (factory.context != null) { | 3739 } else if (factory.context != null) { |
| 3714 throw new IllegalStateException("Source factories cannot be shared betwe
en contexts"); | 3740 throw new IllegalStateException("Source factories cannot be shared betwe
en contexts"); |
| 3715 } | 3741 } |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4420 * @param sourceEntry the cache entry associated with the source | 4446 * @param sourceEntry the cache entry associated with the source |
| 4421 * @param isPriority `true` if the source is a priority source | 4447 * @param isPriority `true` if the source is a priority source |
| 4422 * @param hintsEnabled `true` if hints are currently enabled | 4448 * @param hintsEnabled `true` if hints are currently enabled |
| 4423 * @param sources the set to which sources should be added | 4449 * @param sources the set to which sources should be added |
| 4424 */ | 4450 */ |
| 4425 void getSourcesNeedingProcessing2(Source source, SourceEntry sourceEntry, bool
isPriority, bool hintsEnabled, Set<Source> sources) { | 4451 void getSourcesNeedingProcessing2(Source source, SourceEntry sourceEntry, bool
isPriority, bool hintsEnabled, Set<Source> sources) { |
| 4426 if (sourceEntry is DartEntry) { | 4452 if (sourceEntry is DartEntry) { |
| 4427 DartEntry dartEntry = sourceEntry as DartEntry; | 4453 DartEntry dartEntry = sourceEntry as DartEntry; |
| 4428 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); | 4454 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); |
| 4429 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { | 4455 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { |
| 4430 javaSetAdd(sources, source); | 4456 sources.add(source); |
| 4431 return; | 4457 return; |
| 4432 } | 4458 } |
| 4433 if (isPriority) { | 4459 if (isPriority) { |
| 4434 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; | 4460 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; |
| 4435 if (parseUnit == null) { | 4461 if (parseUnit == null) { |
| 4436 javaSetAdd(sources, source); | 4462 sources.add(source); |
| 4437 return; | 4463 return; |
| 4438 } | 4464 } |
| 4439 } | 4465 } |
| 4440 for (Source librarySource in getLibrariesContaining(source)) { | 4466 for (Source librarySource in getLibrariesContaining(source)) { |
| 4441 SourceEntry libraryEntry = _cache.get(librarySource); | 4467 SourceEntry libraryEntry = _cache.get(librarySource); |
| 4442 if (libraryEntry is DartEntry) { | 4468 if (libraryEntry is DartEntry) { |
| 4443 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); | 4469 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); |
| 4444 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { | 4470 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { |
| 4445 javaSetAdd(sources, source); | 4471 sources.add(source); |
| 4446 return; | 4472 return; |
| 4447 } | 4473 } |
| 4448 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_
UNIT, librarySource); | 4474 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_
UNIT, librarySource); |
| 4449 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority &&
identical(resolvedUnitState, CacheState.FLUSHED))) { | 4475 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority &&
identical(resolvedUnitState, CacheState.FLUSHED))) { |
| 4450 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); | 4476 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); |
| 4451 if (libraryElement != null) { | 4477 if (libraryElement != null) { |
| 4452 javaSetAdd(sources, source); | 4478 sources.add(source); |
| 4453 return; | 4479 return; |
| 4454 } | 4480 } |
| 4455 } | 4481 } |
| 4456 CacheState verificationErrorsState = dartEntry.getState2(DartEntry.VER
IFICATION_ERRORS, librarySource); | 4482 CacheState verificationErrorsState = dartEntry.getState2(DartEntry.VER
IFICATION_ERRORS, librarySource); |
| 4457 if (identical(verificationErrorsState, CacheState.INVALID) || (isPrior
ity && identical(verificationErrorsState, CacheState.FLUSHED))) { | 4483 if (identical(verificationErrorsState, CacheState.INVALID) || (isPrior
ity && identical(verificationErrorsState, CacheState.FLUSHED))) { |
| 4458 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); | 4484 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); |
| 4459 if (libraryElement != null) { | 4485 if (libraryElement != null) { |
| 4460 javaSetAdd(sources, source); | 4486 sources.add(source); |
| 4461 return; | 4487 return; |
| 4462 } | 4488 } |
| 4463 } | 4489 } |
| 4464 if (hintsEnabled) { | 4490 if (hintsEnabled) { |
| 4465 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, library
Source); | 4491 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, library
Source); |
| 4466 if (identical(hintsState, CacheState.INVALID) || (isPriority && iden
tical(hintsState, CacheState.FLUSHED))) { | 4492 if (identical(hintsState, CacheState.INVALID) || (isPriority && iden
tical(hintsState, CacheState.FLUSHED))) { |
| 4467 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); | 4493 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); |
| 4468 if (libraryElement != null) { | 4494 if (libraryElement != null) { |
| 4469 javaSetAdd(sources, source); | 4495 sources.add(source); |
| 4470 return; | 4496 return; |
| 4471 } | 4497 } |
| 4472 } | 4498 } |
| 4473 } | 4499 } |
| 4474 } | 4500 } |
| 4475 } | 4501 } |
| 4476 } else if (sourceEntry is HtmlEntry) { | 4502 } else if (sourceEntry is HtmlEntry) { |
| 4477 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; | 4503 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; |
| 4478 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT); | 4504 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT); |
| 4479 if (identical(parsedUnitState, CacheState.INVALID) || (isPriority && ident
ical(parsedUnitState, CacheState.FLUSHED))) { | 4505 if (identical(parsedUnitState, CacheState.INVALID) || (isPriority && ident
ical(parsedUnitState, CacheState.FLUSHED))) { |
| 4480 javaSetAdd(sources, source); | 4506 sources.add(source); |
| 4481 return; | 4507 return; |
| 4482 } | 4508 } |
| 4483 CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT); | 4509 CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT); |
| 4484 if (identical(elementState, CacheState.INVALID) || (isPriority && identica
l(elementState, CacheState.FLUSHED))) { | 4510 if (identical(elementState, CacheState.INVALID) || (isPriority && identica
l(elementState, CacheState.FLUSHED))) { |
| 4485 javaSetAdd(sources, source); | 4511 sources.add(source); |
| 4486 return; | 4512 return; |
| 4487 } | 4513 } |
| 4488 } | 4514 } |
| 4489 } | 4515 } |
| 4490 | 4516 |
| 4491 /** | 4517 /** |
| 4492 * Invalidate all of the resolution results computed by this context. | 4518 * Invalidate all of the resolution results computed by this context. |
| 4493 * | 4519 * |
| 4494 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 4520 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 4495 */ | 4521 */ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4543 * infinite recursion | 4569 * infinite recursion |
| 4544 * @return `true` if this library is, or depends on, dart:html | 4570 * @return `true` if this library is, or depends on, dart:html |
| 4545 */ | 4571 */ |
| 4546 bool isClient(LibraryElement library, Source htmlSource, Set<LibraryElement> v
isitedLibraries) { | 4572 bool isClient(LibraryElement library, Source htmlSource, Set<LibraryElement> v
isitedLibraries) { |
| 4547 if (visitedLibraries.contains(library)) { | 4573 if (visitedLibraries.contains(library)) { |
| 4548 return false; | 4574 return false; |
| 4549 } | 4575 } |
| 4550 if (library.source == htmlSource) { | 4576 if (library.source == htmlSource) { |
| 4551 return true; | 4577 return true; |
| 4552 } | 4578 } |
| 4553 javaSetAdd(visitedLibraries, library); | 4579 visitedLibraries.add(library); |
| 4554 for (LibraryElement imported in library.importedLibraries) { | 4580 for (LibraryElement imported in library.importedLibraries) { |
| 4555 if (isClient(imported, htmlSource, visitedLibraries)) { | 4581 if (isClient(imported, htmlSource, visitedLibraries)) { |
| 4556 return true; | 4582 return true; |
| 4557 } | 4583 } |
| 4558 } | 4584 } |
| 4559 for (LibraryElement exported in library.exportedLibraries) { | 4585 for (LibraryElement exported in library.exportedLibraries) { |
| 4560 if (isClient(exported, htmlSource, visitedLibraries)) { | 4586 if (isClient(exported, htmlSource, visitedLibraries)) { |
| 4561 return true; | 4587 return true; |
| 4562 } | 4588 } |
| 4563 } | 4589 } |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4845 if (htmlEntry == null) { | 4871 if (htmlEntry == null) { |
| 4846 throw new AnalysisException.con1("An HTML file became a non-HTML fil
e: ${source.fullName}"); | 4872 throw new AnalysisException.con1("An HTML file became a non-HTML fil
e: ${source.fullName}"); |
| 4847 } | 4873 } |
| 4848 } | 4874 } |
| 4849 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; | 4875 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; |
| 4850 if (thrownException == null) { | 4876 if (thrownException == null) { |
| 4851 LineInfo lineInfo = task.lineInfo; | 4877 LineInfo lineInfo = task.lineInfo; |
| 4852 HtmlUnit unit = task.htmlUnit; | 4878 HtmlUnit unit = task.htmlUnit; |
| 4853 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | 4879 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo); |
| 4854 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit); | 4880 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit); |
| 4881 htmlCopy.setValue(HtmlEntry.PARSE_ERRORS, task.errors); |
| 4855 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibra
ries); | 4882 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibra
ries); |
| 4856 ChangeNoticeImpl notice = getNotice(source); | 4883 ChangeNoticeImpl notice = getNotice(source); |
| 4857 notice.setErrors(htmlEntry.allErrors, lineInfo); | 4884 notice.setErrors(htmlEntry.allErrors, lineInfo); |
| 4858 } else { | 4885 } else { |
| 4859 htmlCopy.recordParseError(); | 4886 htmlCopy.recordParseError(); |
| 4860 } | 4887 } |
| 4861 htmlCopy.exception = thrownException; | 4888 htmlCopy.exception = thrownException; |
| 4862 _cache.put(source, htmlCopy); | 4889 _cache.put(source, htmlCopy); |
| 4863 htmlEntry = htmlCopy; | 4890 htmlEntry = htmlCopy; |
| 4864 } else { | 4891 } else { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5147 SourceEntry sourceEntry = _cache.get(source); | 5174 SourceEntry sourceEntry = _cache.get(source); |
| 5148 if (sourceEntry is HtmlEntry) { | 5175 if (sourceEntry is HtmlEntry) { |
| 5149 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; | 5176 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; |
| 5150 htmlCopy.modificationTime = source.modificationStamp; | 5177 htmlCopy.modificationTime = source.modificationStamp; |
| 5151 htmlCopy.invalidateAllInformation(); | 5178 htmlCopy.invalidateAllInformation(); |
| 5152 _cache.put(source, htmlCopy); | 5179 _cache.put(source, htmlCopy); |
| 5153 } else if (sourceEntry is DartEntry) { | 5180 } else if (sourceEntry is DartEntry) { |
| 5154 List<Source> containingLibraries = getLibrariesContaining(source); | 5181 List<Source> containingLibraries = getLibrariesContaining(source); |
| 5155 Set<Source> librariesToInvalidate = new Set<Source>(); | 5182 Set<Source> librariesToInvalidate = new Set<Source>(); |
| 5156 for (Source containingLibrary in containingLibraries) { | 5183 for (Source containingLibrary in containingLibraries) { |
| 5157 javaSetAdd(librariesToInvalidate, containingLibrary); | 5184 librariesToInvalidate.add(containingLibrary); |
| 5158 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar
y)) { | 5185 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar
y)) { |
| 5159 javaSetAdd(librariesToInvalidate, dependentLibrary); | 5186 librariesToInvalidate.add(dependentLibrary); |
| 5160 } | 5187 } |
| 5161 } | 5188 } |
| 5162 for (Source library in librariesToInvalidate) { | 5189 for (Source library in librariesToInvalidate) { |
| 5163 invalidateLibraryResolution(library); | 5190 invalidateLibraryResolution(library); |
| 5164 } | 5191 } |
| 5165 DartEntryImpl dartCopy = (sourceEntry as DartEntry).writableCopy; | 5192 DartEntryImpl dartCopy = (sourceEntry as DartEntry).writableCopy; |
| 5166 dartCopy.modificationTime = source.modificationStamp; | 5193 dartCopy.modificationTime = source.modificationStamp; |
| 5167 dartCopy.invalidateAllInformation(); | 5194 dartCopy.invalidateAllInformation(); |
| 5168 _cache.put(source, dartCopy); | 5195 _cache.put(source, dartCopy); |
| 5169 } | 5196 } |
| 5170 } | 5197 } |
| 5171 | 5198 |
| 5172 /** | 5199 /** |
| 5173 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 5200 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 5174 * | 5201 * |
| 5175 * @param source the source that has been deleted | 5202 * @param source the source that has been deleted |
| 5176 */ | 5203 */ |
| 5177 void sourceRemoved(Source source) { | 5204 void sourceRemoved(Source source) { |
| 5178 SourceEntry sourceEntry = _cache.get(source); | 5205 SourceEntry sourceEntry = _cache.get(source); |
| 5179 if (sourceEntry is DartEntry) { | 5206 if (sourceEntry is DartEntry) { |
| 5180 Set<Source> libraries = new Set<Source>(); | 5207 Set<Source> libraries = new Set<Source>(); |
| 5181 for (Source librarySource in getLibrariesContaining(source)) { | 5208 for (Source librarySource in getLibrariesContaining(source)) { |
| 5182 javaSetAdd(libraries, librarySource); | 5209 libraries.add(librarySource); |
| 5183 for (Source dependentLibrary in getLibrariesDependingOn(librarySource))
{ | 5210 for (Source dependentLibrary in getLibrariesDependingOn(librarySource))
{ |
| 5184 javaSetAdd(libraries, dependentLibrary); | 5211 libraries.add(dependentLibrary); |
| 5185 } | 5212 } |
| 5186 } | 5213 } |
| 5187 for (Source librarySource in libraries) { | 5214 for (Source librarySource in libraries) { |
| 5188 invalidateLibraryResolution(librarySource); | 5215 invalidateLibraryResolution(librarySource); |
| 5189 } | 5216 } |
| 5190 } | 5217 } |
| 5191 _cache.remove(source); | 5218 _cache.remove(source); |
| 5192 } | 5219 } |
| 5193 } | 5220 } |
| 5194 | 5221 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5303 */ | 5330 */ |
| 5304 bool _dart2jsHint = true; | 5331 bool _dart2jsHint = true; |
| 5305 | 5332 |
| 5306 /** | 5333 /** |
| 5307 * A flag indicating whether analysis is to generate hint results (e.g. type i
nference based | 5334 * A flag indicating whether analysis is to generate hint results (e.g. type i
nference based |
| 5308 * information and pub best practices). | 5335 * information and pub best practices). |
| 5309 */ | 5336 */ |
| 5310 bool _hint = true; | 5337 bool _hint = true; |
| 5311 | 5338 |
| 5312 /** | 5339 /** |
| 5313 * A flag indicating whether analysis is to use strict mode. In strict mode, e
rror reporting is | |
| 5314 * based exclusively on the static type information. | |
| 5315 */ | |
| 5316 bool _strictMode = true; | |
| 5317 | |
| 5318 /** | |
| 5319 * Initialize a newly created set of analysis options to have their default va
lues. | 5340 * Initialize a newly created set of analysis options to have their default va
lues. |
| 5320 */ | 5341 */ |
| 5321 AnalysisOptionsImpl(); | 5342 AnalysisOptionsImpl(); |
| 5322 | 5343 |
| 5323 /** | 5344 /** |
| 5324 * Initialize a newly created set of analysis options to have the same values
as those in the | 5345 * Initialize a newly created set of analysis options to have the same values
as those in the |
| 5325 * given set of analysis options. | 5346 * given set of analysis options. |
| 5326 * | 5347 * |
| 5327 * @param options the analysis options whose values are being copied | 5348 * @param options the analysis options whose values are being copied |
| 5328 */ | 5349 */ |
| 5329 AnalysisOptionsImpl.con1(AnalysisOptions options) { | 5350 AnalysisOptionsImpl.con1(AnalysisOptions options) { |
| 5330 _cacheSize = options.cacheSize; | 5351 _cacheSize = options.cacheSize; |
| 5331 _dart2jsHint = options.dart2jsHint; | 5352 _dart2jsHint = options.dart2jsHint; |
| 5332 _hint = options.hint; | 5353 _hint = options.hint; |
| 5333 _strictMode = options.strictMode; | |
| 5334 } | 5354 } |
| 5335 | 5355 |
| 5336 int get cacheSize => _cacheSize; | 5356 int get cacheSize => _cacheSize; |
| 5337 | 5357 |
| 5338 bool get dart2jsHint => _dart2jsHint; | 5358 bool get dart2jsHint => _dart2jsHint; |
| 5339 | 5359 |
| 5340 bool get hint => _hint; | 5360 bool get hint => _hint; |
| 5341 | 5361 |
| 5342 /** | 5362 /** |
| 5343 * Return `true` if analysis is to use strict mode. In strict mode, error repo
rting is based | |
| 5344 * exclusively on the static type information. | |
| 5345 * | |
| 5346 * @return `true` if analysis is to use strict mode | |
| 5347 */ | |
| 5348 bool get strictMode => _strictMode; | |
| 5349 | |
| 5350 /** | |
| 5351 * Set the maximum number of sources for which AST structures should be kept i
n the cache to the | 5363 * Set the maximum number of sources for which AST structures should be kept i
n the cache to the |
| 5352 * given size. | 5364 * given size. |
| 5353 * | 5365 * |
| 5354 * @param cacheSize the maximum number of sources for which AST structures sho
uld be kept in the | 5366 * @param cacheSize the maximum number of sources for which AST structures sho
uld be kept in the |
| 5355 * cache | 5367 * cache |
| 5356 */ | 5368 */ |
| 5357 void set cacheSize(int cacheSize) { | 5369 void set cacheSize(int cacheSize) { |
| 5358 this._cacheSize = cacheSize; | 5370 this._cacheSize = cacheSize; |
| 5359 } | 5371 } |
| 5360 | 5372 |
| 5361 /** | 5373 /** |
| 5362 * Set whether analysis is to generate dart2js related hint results. | 5374 * Set whether analysis is to generate dart2js related hint results. |
| 5363 * | 5375 * |
| 5364 * @param hint `true` if analysis is to generate dart2js related hint results | 5376 * @param hint `true` if analysis is to generate dart2js related hint results |
| 5365 */ | 5377 */ |
| 5366 void set dart2jsHint(bool dart2jsHints) { | 5378 void set dart2jsHint(bool dart2jsHints) { |
| 5367 this._dart2jsHint = dart2jsHints; | 5379 this._dart2jsHint = dart2jsHints; |
| 5368 } | 5380 } |
| 5369 | 5381 |
| 5370 /** | 5382 /** |
| 5371 * Set whether analysis is to generate hint results (e.g. type inference based
information and pub | 5383 * Set whether analysis is to generate hint results (e.g. type inference based
information and pub |
| 5372 * best practices). | 5384 * best practices). |
| 5373 * | 5385 * |
| 5374 * @param hint `true` if analysis is to generate hint results | 5386 * @param hint `true` if analysis is to generate hint results |
| 5375 */ | 5387 */ |
| 5376 void set hint(bool hint) { | 5388 void set hint(bool hint) { |
| 5377 this._hint = hint; | 5389 this._hint = hint; |
| 5378 } | 5390 } |
| 5379 | |
| 5380 /** | |
| 5381 * Set whether analysis is to use strict mode to the given value. In strict mo
de, error reporting | |
| 5382 * is based exclusively on the static type information. | |
| 5383 * | |
| 5384 * @param isStrict `true` if analysis is to use strict mode | |
| 5385 */ | |
| 5386 void set strictMode(bool isStrict) { | |
| 5387 _strictMode = isStrict; | |
| 5388 } | |
| 5389 } | 5391 } |
| 5390 | 5392 |
| 5391 /** | 5393 /** |
| 5392 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis
results | 5394 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis
results |
| 5393 * associated with a given source. | 5395 * associated with a given source. |
| 5394 * | 5396 * |
| 5395 * @coverage dart.engine | 5397 * @coverage dart.engine |
| 5396 */ | 5398 */ |
| 5397 class ChangeNoticeImpl implements ChangeNotice { | 5399 class ChangeNoticeImpl implements ChangeNotice { |
| 5398 /** | 5400 /** |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5811 return null; | 5813 return null; |
| 5812 } | 5814 } |
| 5813 return cache; | 5815 return cache; |
| 5814 } | 5816 } |
| 5815 | 5817 |
| 5816 /** | 5818 /** |
| 5817 * Determine if incremental analysis can be performed from the given informati
on. | 5819 * Determine if incremental analysis can be performed from the given informati
on. |
| 5818 * | 5820 * |
| 5819 * @param cache the prior cache or `null` if none | 5821 * @param cache the prior cache or `null` if none |
| 5820 * @param source the source being updated (not `null`) | 5822 * @param source the source being updated (not `null`) |
| 5821 * @param oldContents the original source contents prior to this update (not `
null`) | 5823 * @param oldContents the original source contents prior to this update (may b
e `null`) |
| 5822 * @param newContents the new contents after this incremental change (not `nul
l`) | 5824 * @param newContents the new contents after this incremental change (not `nul
l`) |
| 5823 * @param offset the offset at which the change occurred | 5825 * @param offset the offset at which the change occurred |
| 5824 * @param oldLength the length of the text being replaced | 5826 * @param oldLength the length of the text being replaced |
| 5825 * @param newLength the length of the replacement text | 5827 * @param newLength the length of the replacement text |
| 5826 * @param sourceEntry the cached entry for the given source or `null` if none | 5828 * @param sourceEntry the cached entry for the given source or `null` if none |
| 5827 * @return the cache used for incremental analysis or `null` if incremental an
alysis cannot | 5829 * @return the cache used for incremental analysis or `null` if incremental an
alysis cannot |
| 5828 * be performed | 5830 * be performed |
| 5829 */ | 5831 */ |
| 5830 static IncrementalAnalysisCache update(IncrementalAnalysisCache cache, Source
source, String oldContents, String newContents, int offset, int oldLength, int n
ewLength, SourceEntry sourceEntry) { | 5832 static IncrementalAnalysisCache update(IncrementalAnalysisCache cache, Source
source, String oldContents, String newContents, int offset, int oldLength, int n
ewLength, SourceEntry sourceEntry) { |
| 5831 Source librarySource = null; | 5833 Source librarySource = null; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5871 * equivalent to the fully parsed unit. | 5873 * equivalent to the fully parsed unit. |
| 5872 * | 5874 * |
| 5873 * @param cache the prior cache or `null` if none | 5875 * @param cache the prior cache or `null` if none |
| 5874 * @param source the source of the compilation unit that was parsed (not `null
`) | 5876 * @param source the source of the compilation unit that was parsed (not `null
`) |
| 5875 * @param unit the compilation unit that was just parsed | 5877 * @param unit the compilation unit that was just parsed |
| 5876 * @return the cache used for incremental analysis or `null` if incremental an
alysis results | 5878 * @return the cache used for incremental analysis or `null` if incremental an
alysis results |
| 5877 * cannot be cached for the next incremental analysis | 5879 * cannot be cached for the next incremental analysis |
| 5878 */ | 5880 */ |
| 5879 static IncrementalAnalysisCache verifyStructure(IncrementalAnalysisCache cache
, Source source, CompilationUnit unit) { | 5881 static IncrementalAnalysisCache verifyStructure(IncrementalAnalysisCache cache
, Source source, CompilationUnit unit) { |
| 5880 if (cache != null && unit != null && cache.source == source) { | 5882 if (cache != null && unit != null && cache.source == source) { |
| 5881 if (!ASTComparator.equals3(cache.resolvedUnit, unit)) { | 5883 if (!ASTComparator.equals4(cache.resolvedUnit, unit)) { |
| 5882 return null; | 5884 return null; |
| 5883 } | 5885 } |
| 5884 } | 5886 } |
| 5885 return cache; | 5887 return cache; |
| 5886 } | 5888 } |
| 5887 | 5889 |
| 5888 Source librarySource; | 5890 Source librarySource; |
| 5889 | 5891 |
| 5890 Source source; | 5892 Source source; |
| 5891 | 5893 |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6678 } | 6680 } |
| 6679 } | 6681 } |
| 6680 | 6682 |
| 6681 void onError(AnalysisError error) { | 6683 void onError(AnalysisError error) { |
| 6682 Source source = error.source; | 6684 Source source = error.source; |
| 6683 Set<AnalysisError> errorsForSource = _errors[source]; | 6685 Set<AnalysisError> errorsForSource = _errors[source]; |
| 6684 if (_errors[source] == null) { | 6686 if (_errors[source] == null) { |
| 6685 errorsForSource = new Set<AnalysisError>(); | 6687 errorsForSource = new Set<AnalysisError>(); |
| 6686 _errors[source] = errorsForSource; | 6688 _errors[source] = errorsForSource; |
| 6687 } | 6689 } |
| 6688 javaSetAdd(errorsForSource, error); | 6690 errorsForSource.add(error); |
| 6689 } | 6691 } |
| 6690 } | 6692 } |
| 6691 | 6693 |
| 6692 /** | 6694 /** |
| 6693 * Instances of the class `ResolutionEraser` remove any resolution information f
rom an AST | 6695 * Instances of the class `ResolutionEraser` remove any resolution information f
rom an AST |
| 6694 * structure when used to visit that structure. | 6696 * structure when used to visit that structure. |
| 6695 */ | 6697 */ |
| 6696 class ResolutionEraser extends GeneralizingASTVisitor<Object> { | 6698 class ResolutionEraser extends GeneralizingASTVisitor<Object> { |
| 6697 Object visitAssignmentExpression(AssignmentExpression node) { | 6699 Object visitAssignmentExpression(AssignmentExpression node) { |
| 6698 node.staticElement = null; | 6700 node.staticElement = null; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7315 return "parse as dart null source"; | 7317 return "parse as dart null source"; |
| 7316 } | 7318 } |
| 7317 return "parse as dart ${source.fullName}"; | 7319 return "parse as dart ${source.fullName}"; |
| 7318 } | 7320 } |
| 7319 | 7321 |
| 7320 void internalPerform() { | 7322 void internalPerform() { |
| 7321 RecordingErrorListener errorListener = new RecordingErrorListener(); | 7323 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 7322 List<Token> token = [null]; | 7324 List<Token> token = [null]; |
| 7323 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 7325 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
| 7324 try { | 7326 try { |
| 7325 Source_ContentReceiver receiver = new Source_ContentReceiver_12(this, erro
rListener, token); | 7327 Source_ContentReceiver receiver = new Source_ContentReceiver_11(this, erro
rListener, token); |
| 7326 try { | 7328 try { |
| 7327 source.getContents(receiver); | 7329 source.getContents(receiver); |
| 7328 } on JavaException catch (exception) { | 7330 } on JavaException catch (exception) { |
| 7329 modificationTime = source.modificationStamp; | 7331 modificationTime = source.modificationStamp; |
| 7330 throw new AnalysisException.con3(exception); | 7332 throw new AnalysisException.con3(exception); |
| 7331 } | 7333 } |
| 7332 } finally { | 7334 } finally { |
| 7333 timeCounterScan.stop(); | 7335 timeCounterScan.stop(); |
| 7334 } | 7336 } |
| 7335 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 7337 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 7336 try { | 7338 try { |
| 7337 Parser parser = new Parser(source, errorListener); | 7339 Parser parser = new Parser(source, errorListener); |
| 7338 compilationUnit = parser.parseCompilationUnit(token[0]); | 7340 compilationUnit = parser.parseCompilationUnit(token[0]); |
| 7339 errors = errorListener.getErrors2(source); | 7341 errors = errorListener.getErrors2(source); |
| 7340 for (Directive directive in compilationUnit.directives) { | 7342 for (Directive directive in compilationUnit.directives) { |
| 7341 if (directive is ExportDirective) { | 7343 if (directive is ExportDirective) { |
| 7342 Source exportSource = resolveSource(source, directive as ExportDirecti
ve); | 7344 Source exportSource = resolveSource(source, directive as ExportDirecti
ve); |
| 7343 if (exportSource != null) { | 7345 if (exportSource != null) { |
| 7344 javaSetAdd(_exportedSources, exportSource); | 7346 _exportedSources.add(exportSource); |
| 7345 } | 7347 } |
| 7346 } else if (directive is ImportDirective) { | 7348 } else if (directive is ImportDirective) { |
| 7347 Source importSource = resolveSource(source, directive as ImportDirecti
ve); | 7349 Source importSource = resolveSource(source, directive as ImportDirecti
ve); |
| 7348 if (importSource != null) { | 7350 if (importSource != null) { |
| 7349 javaSetAdd(_importedSources, importSource); | 7351 _importedSources.add(importSource); |
| 7350 } | 7352 } |
| 7351 } else if (directive is LibraryDirective) { | 7353 } else if (directive is LibraryDirective) { |
| 7352 _hasLibraryDirective2 = true; | 7354 _hasLibraryDirective2 = true; |
| 7353 } else if (directive is PartDirective) { | 7355 } else if (directive is PartDirective) { |
| 7354 Source partSource = resolveSource(source, directive as PartDirective); | 7356 Source partSource = resolveSource(source, directive as PartDirective); |
| 7355 if (partSource != null) { | 7357 if (partSource != null) { |
| 7356 javaSetAdd(_includedSources, partSource); | 7358 _includedSources.add(partSource); |
| 7357 } | 7359 } |
| 7358 } else if (directive is PartOfDirective) { | 7360 } else if (directive is PartOfDirective) { |
| 7359 _hasPartOfDirective2 = true; | 7361 _hasPartOfDirective2 = true; |
| 7360 } | 7362 } |
| 7361 } | 7363 } |
| 7362 compilationUnit.lineInfo = lineInfo; | 7364 compilationUnit.lineInfo = lineInfo; |
| 7363 } finally { | 7365 } finally { |
| 7364 timeCounterParse.stop(); | 7366 timeCounterParse.stop(); |
| 7365 } | 7367 } |
| 7366 } | 7368 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7399 */ | 7401 */ |
| 7400 List<Source> toArray(Set<Source> sources) { | 7402 List<Source> toArray(Set<Source> sources) { |
| 7401 int size = sources.length; | 7403 int size = sources.length; |
| 7402 if (size == 0) { | 7404 if (size == 0) { |
| 7403 return Source.EMPTY_ARRAY; | 7405 return Source.EMPTY_ARRAY; |
| 7404 } | 7406 } |
| 7405 return new List.from(sources); | 7407 return new List.from(sources); |
| 7406 } | 7408 } |
| 7407 } | 7409 } |
| 7408 | 7410 |
| 7409 class Source_ContentReceiver_12 implements Source_ContentReceiver { | 7411 class Source_ContentReceiver_11 implements Source_ContentReceiver { |
| 7410 final ParseDartTask ParseDartTask_this; | 7412 final ParseDartTask ParseDartTask_this; |
| 7411 | 7413 |
| 7412 RecordingErrorListener errorListener; | 7414 RecordingErrorListener errorListener; |
| 7413 | 7415 |
| 7414 List<Token> token; | 7416 List<Token> token; |
| 7415 | 7417 |
| 7416 Source_ContentReceiver_12(this.ParseDartTask_this, this.errorListener, this.to
ken); | 7418 Source_ContentReceiver_11(this.ParseDartTask_this, this.errorListener, this.to
ken); |
| 7417 | 7419 |
| 7418 void accept(CharBuffer contents, int modificationTime) { | 7420 void accept(CharBuffer contents, int modificationTime) { |
| 7419 ParseDartTask_this.modificationTime = modificationTime; | 7421 ParseDartTask_this.modificationTime = modificationTime; |
| 7420 Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceRea
der(contents), errorListener); | 7422 Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceRea
der(contents), errorListener); |
| 7421 token[0] = scanner.tokenize(); | 7423 token[0] = scanner.tokenize(); |
| 7422 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts); | 7424 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts); |
| 7423 } | 7425 } |
| 7424 | 7426 |
| 7425 void accept2(String contents, int modificationTime) { | 7427 void accept2(String contents, int modificationTime) { |
| 7426 ParseDartTask_this.modificationTime = modificationTime; | 7428 ParseDartTask_this.modificationTime = modificationTime; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 7448 * The line information that was produced. | 7450 * The line information that was produced. |
| 7449 */ | 7451 */ |
| 7450 LineInfo lineInfo; | 7452 LineInfo lineInfo; |
| 7451 | 7453 |
| 7452 /** | 7454 /** |
| 7453 * The HTML unit that was produced by parsing the source. | 7455 * The HTML unit that was produced by parsing the source. |
| 7454 */ | 7456 */ |
| 7455 HtmlUnit htmlUnit; | 7457 HtmlUnit htmlUnit; |
| 7456 | 7458 |
| 7457 /** | 7459 /** |
| 7460 * The errors that were produced by scanning and parsing the source. |
| 7461 */ |
| 7462 List<AnalysisError> errors = AnalysisError.NO_ERRORS; |
| 7463 |
| 7464 /** |
| 7458 * An array containing the sources of the libraries that are referenced within
the HTML. | 7465 * An array containing the sources of the libraries that are referenced within
the HTML. |
| 7459 */ | 7466 */ |
| 7460 List<Source> referencedLibraries = Source.EMPTY_ARRAY; | 7467 List<Source> referencedLibraries = Source.EMPTY_ARRAY; |
| 7461 | 7468 |
| 7462 /** | 7469 /** |
| 7463 * The name of the 'src' attribute in a HTML tag. | 7470 * The name of the 'src' attribute in a HTML tag. |
| 7464 */ | 7471 */ |
| 7465 static String _ATTRIBUTE_SRC = "src"; | 7472 static String _ATTRIBUTE_SRC = "src"; |
| 7466 | 7473 |
| 7467 /** | 7474 /** |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7502 void internalPerform() { | 7509 void internalPerform() { |
| 7503 HtmlScanner scanner = new HtmlScanner(source); | 7510 HtmlScanner scanner = new HtmlScanner(source); |
| 7504 try { | 7511 try { |
| 7505 source.getContents(scanner); | 7512 source.getContents(scanner); |
| 7506 } on JavaException catch (exception) { | 7513 } on JavaException catch (exception) { |
| 7507 throw new AnalysisException.con3(exception); | 7514 throw new AnalysisException.con3(exception); |
| 7508 } | 7515 } |
| 7509 HtmlScanResult scannerResult = scanner.result; | 7516 HtmlScanResult scannerResult = scanner.result; |
| 7510 modificationTime = scannerResult.modificationTime; | 7517 modificationTime = scannerResult.modificationTime; |
| 7511 lineInfo = new LineInfo(scannerResult.lineStarts); | 7518 lineInfo = new LineInfo(scannerResult.lineStarts); |
| 7512 HtmlParseResult result = new HtmlParser(source).parse(scannerResult); | 7519 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 7520 HtmlParseResult result = new HtmlParser(source, errorListener).parse(scanner
Result); |
| 7513 htmlUnit = result.htmlUnit; | 7521 htmlUnit = result.htmlUnit; |
| 7522 errors = errorListener.getErrors2(source); |
| 7514 referencedLibraries = librarySources; | 7523 referencedLibraries = librarySources; |
| 7515 } | 7524 } |
| 7516 | 7525 |
| 7517 /** | 7526 /** |
| 7518 * Return the sources of libraries that are referenced in the specified HTML f
ile. | 7527 * Return the sources of libraries that are referenced in the specified HTML f
ile. |
| 7519 * | 7528 * |
| 7520 * @return the sources of libraries that are referenced in the HTML file | 7529 * @return the sources of libraries that are referenced in the HTML file |
| 7521 */ | 7530 */ |
| 7522 List<Source> get librarySources { | 7531 List<Source> get librarySources { |
| 7523 List<Source> libraries = new List<Source>(); | 7532 List<Source> libraries = new List<Source>(); |
| 7524 htmlUnit.accept(new RecursiveXmlVisitor_13(this, libraries)); | 7533 htmlUnit.accept(new RecursiveXmlVisitor_12(this, libraries)); |
| 7525 if (libraries.isEmpty) { | 7534 if (libraries.isEmpty) { |
| 7526 return Source.EMPTY_ARRAY; | 7535 return Source.EMPTY_ARRAY; |
| 7527 } | 7536 } |
| 7528 return new List.from(libraries); | 7537 return new List.from(libraries); |
| 7529 } | 7538 } |
| 7530 } | 7539 } |
| 7531 | 7540 |
| 7532 class RecursiveXmlVisitor_13 extends RecursiveXmlVisitor<Object> { | 7541 class RecursiveXmlVisitor_12 extends RecursiveXmlVisitor<Object> { |
| 7533 final ParseHtmlTask ParseHtmlTask_this; | 7542 final ParseHtmlTask ParseHtmlTask_this; |
| 7534 | 7543 |
| 7535 List<Source> libraries; | 7544 List<Source> libraries; |
| 7536 | 7545 |
| 7537 RecursiveXmlVisitor_13(this.ParseHtmlTask_this, this.libraries) : super(); | 7546 RecursiveXmlVisitor_12(this.ParseHtmlTask_this, this.libraries) : super(); |
| 7538 | 7547 |
| 7539 Object visitXmlTagNode(XmlTagNode node) { | 7548 Object visitHtmlScriptTagNode(HtmlScriptTagNode node) { |
| 7540 if (javaStringEqualsIgnoreCase(node.tag.lexeme, ParseHtmlTask._TAG_SCRIPT))
{ | 7549 XmlAttributeNode scriptAttribute = null; |
| 7541 bool isDartScript = false; | 7550 for (XmlAttributeNode attribute in node.attributes) { |
| 7542 XmlAttributeNode scriptAttribute = null; | 7551 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATTRI
BUTE_SRC)) { |
| 7543 for (XmlAttributeNode attribute in node.attributes) { | 7552 scriptAttribute = attribute; |
| 7544 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATT
RIBUTE_SRC)) { | |
| 7545 scriptAttribute = attribute; | |
| 7546 } else if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTa
sk._ATTRIBUTE_TYPE)) { | |
| 7547 if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DAR
T)) { | |
| 7548 isDartScript = true; | |
| 7549 } | |
| 7550 } | |
| 7551 } | |
| 7552 if (isDartScript && scriptAttribute != null) { | |
| 7553 try { | |
| 7554 Uri uri = new Uri(path: scriptAttribute.text); | |
| 7555 String fileName = uri.path; | |
| 7556 Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolv
eUri(ParseHtmlTask_this.source, fileName); | |
| 7557 if (librarySource != null && librarySource.exists()) { | |
| 7558 libraries.add(librarySource); | |
| 7559 } | |
| 7560 } on URISyntaxException catch (e) { | |
| 7561 } | |
| 7562 } | 7553 } |
| 7563 } | 7554 } |
| 7564 return super.visitXmlTagNode(node); | 7555 if (scriptAttribute != null) { |
| 7556 try { |
| 7557 Uri uri = new Uri(path: scriptAttribute.text); |
| 7558 String fileName = uri.path; |
| 7559 Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolveU
ri(ParseHtmlTask_this.source, fileName); |
| 7560 if (librarySource != null && librarySource.exists()) { |
| 7561 libraries.add(librarySource); |
| 7562 } |
| 7563 } on URISyntaxException catch (e) { |
| 7564 } |
| 7565 } |
| 7566 return super.visitHtmlScriptTagNode(node); |
| 7565 } | 7567 } |
| 7566 } | 7568 } |
| 7567 | 7569 |
| 7568 /** | 7570 /** |
| 7569 * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library
. | 7571 * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library
. |
| 7570 */ | 7572 */ |
| 7571 class ResolveDartLibraryTask extends AnalysisTask { | 7573 class ResolveDartLibraryTask extends AnalysisTask { |
| 7572 /** | 7574 /** |
| 7573 * The source representing the file whose compilation unit is to be returned. | 7575 * The source representing the file whose compilation unit is to be returned. |
| 7574 */ | 7576 */ |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7841 | 7843 |
| 7842 void logError3(Exception exception) { | 7844 void logError3(Exception exception) { |
| 7843 } | 7845 } |
| 7844 | 7846 |
| 7845 void logInformation(String message) { | 7847 void logInformation(String message) { |
| 7846 } | 7848 } |
| 7847 | 7849 |
| 7848 void logInformation2(String message, Exception exception) { | 7850 void logInformation2(String message, Exception exception) { |
| 7849 } | 7851 } |
| 7850 } | 7852 } |
| OLD | NEW |