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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1776023002: Add AnalysisContext.onResultInvalidated(descriptor). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update Analysis Server. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.generated.engine; 5 library analyzer.src.generated.engine;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 * reference 'dart:html', either directly or indirectly). 507 * reference 'dart:html', either directly or indirectly).
508 * 508 *
509 * <b>Note:</b> In addition to the expected case of returning `false` if the 509 * <b>Note:</b> In addition to the expected case of returning `false` if the
510 * source is known to be a library that cannot be run on the server, this 510 * source is known to be a library that cannot be run on the server, this
511 * method will also return `false` if the source is not known to be a library 511 * method will also return `false` if the source is not known to be a library
512 * or if we do not know whether it can be run on the server. 512 * or if we do not know whether it can be run on the server.
513 */ 513 */
514 bool isServerLibrary(Source librarySource); 514 bool isServerLibrary(Source librarySource);
515 515
516 /** 516 /**
517 * Return the stream that is notified when a result with the given
518 * [descriptor] is changed, e.g. computed or invalidated.
519 */
520 Stream<ResultChangedEvent> onResultChanged(ResultDescriptor descriptor);
521
522 /**
517 * Return the stream that is notified when a new value for the given 523 * Return the stream that is notified when a new value for the given
518 * [descriptor] is computed. 524 * [descriptor] is computed.
519 */ 525 */
526 @deprecated
520 Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor); 527 Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor);
521 528
522 /** 529 /**
523 * Parse the content of the given [source] to produce an AST structure. The 530 * Parse the content of the given [source] to produce an AST structure. The
524 * resulting AST structure may or may not be resolved, and may have a slightly 531 * resulting AST structure may or may not be resolved, and may have a slightly
525 * different structure depending upon whether it is resolved. 532 * different structure depending upon whether it is resolved.
526 * 533 *
527 * Throws an [AnalysisException] if the analysis could not be performed 534 * Throws an [AnalysisException] if the analysis could not be performed
528 * 535 *
529 * <b>Note:</b> This method cannot be used in an async environment. 536 * <b>Note:</b> This method cannot be used in an async environment.
530 */ 537 */
531 CompilationUnit parseCompilationUnit(Source source); 538 CompilationUnit parseCompilationUnit(Source source);
532 539
533 /** 540 /**
534 * Parse a single HTML [source] to produce a document model. 541 * Parse a single HTML [source] to produce a document model.
535 * 542 *
536 * Throws an [AnalysisException] if the analysis could not be performed 543 * Throws an [AnalysisException] if the analysis could not be performed
537 * 544 *
538 * <b>Note:</b> This method cannot be used in an async environment. 545 * <b>Note:</b> This method cannot be used in an async environment.
539 */ 546 */
540 Document parseHtmlDocument(Source source); 547 Document parseHtmlDocument(Source source);
541 548
542 /** 549 /**
543 * Perform the next unit of work required to keep the analysis results 550 * Perform the next unit of work required to keep the analysis results
544 * up-to-date and return information about the consequent changes to the 551 * up-to-date and return information about the consequent changes to the
545 * analysis results. This method can be long running. 552 * analysis results. This method can be long running.
546 * 553 *
547 * The implementation that uses the task model notifies subscribers of 554 * The implementation that uses the task model notifies subscribers of
548 * [onResultComputed] about computed results. 555 * [onResultChanged] about computed results.
549 * 556 *
550 * The following results are computed for Dart sources. 557 * The following results are computed for Dart sources.
551 * 558 *
552 * 1. For explicit and implicit sources: 559 * 1. For explicit and implicit sources:
553 * [PARSED_UNIT] 560 * [PARSED_UNIT]
554 * [RESOLVED_UNIT] 561 * [RESOLVED_UNIT]
555 * 562 *
556 * 2. For explicit sources: 563 * 2. For explicit sources:
557 * [DART_ERRORS]. 564 * [DART_ERRORS].
558 * 565 *
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 * number of characters in the original contents that were replaced. The 1841 * number of characters in the original contents that were replaced. The
1835 * [newLength] is the number of characters in the replacement text. 1842 * [newLength] is the number of characters in the replacement text.
1836 */ 1843 */
1837 ChangeSet_ContentChange( 1844 ChangeSet_ContentChange(
1838 this.contents, this.offset, this.oldLength, this.newLength); 1845 this.contents, this.offset, this.oldLength, this.newLength);
1839 } 1846 }
1840 1847
1841 /** 1848 /**
1842 * [ComputedResult] describes a value computed for a [ResultDescriptor]. 1849 * [ComputedResult] describes a value computed for a [ResultDescriptor].
1843 */ 1850 */
1851 @deprecated
1844 class ComputedResult<V> { 1852 class ComputedResult<V> {
1845 /** 1853 /**
1846 * The context in which the value was computed. 1854 * The context in which the value was computed.
1847 */ 1855 */
1848 final AnalysisContext context; 1856 final AnalysisContext context;
1849 1857
1850 /** 1858 /**
1851 * The descriptor of the result which was computed. 1859 * The descriptor of the result which was computed.
1852 */ 1860 */
1853 final ResultDescriptor<V> descriptor; 1861 final ResultDescriptor<V> descriptor;
1854 1862
1855 /** 1863 /**
1856 * The target for which the result was computed. 1864 * The target for which the result was computed.
1857 */ 1865 */
1858 final AnalysisTarget target; 1866 final AnalysisTarget target;
1859 1867
1860 /** 1868 /**
1861 * The computed value. 1869 * The computed value.
1862 */ 1870 */
1863 final V value; 1871 final V value;
1864 1872
1865 ComputedResult(this.context, this.descriptor, this.target, this.value); 1873 ComputedResult(this.context, this.descriptor, this.target, this.value);
1866 1874
1867 @override 1875 @override
1868 String toString() => '$descriptor of $target in $context'; 1876 String toString() => 'Computed $descriptor of $target in $context';
1869 } 1877 }
1870 1878
1871 /** 1879 /**
1872 * An event indicating when a source either starts or stops being implicitly 1880 * An event indicating when a source either starts or stops being implicitly
1873 * analyzed. 1881 * analyzed.
1874 */ 1882 */
1875 class ImplicitAnalysisEvent { 1883 class ImplicitAnalysisEvent {
1876 /** 1884 /**
1877 * The source whose status has changed. 1885 * The source whose status has changed.
1878 */ 1886 */
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 * Remove any resolution information from the given AST structure. 2409 * Remove any resolution information from the given AST structure.
2402 */ 2410 */
2403 static void erase(AstNode node, {bool eraseDeclarations: true}) { 2411 static void erase(AstNode node, {bool eraseDeclarations: true}) {
2404 ResolutionEraser eraser = new ResolutionEraser(); 2412 ResolutionEraser eraser = new ResolutionEraser();
2405 eraser.eraseDeclarations = eraseDeclarations; 2413 eraser.eraseDeclarations = eraseDeclarations;
2406 node.accept(eraser); 2414 node.accept(eraser);
2407 } 2415 }
2408 } 2416 }
2409 2417
2410 /** 2418 /**
2419 * [ResultChangedEvent] describes a change to an analysis result.
2420 */
2421 class ResultChangedEvent<V> {
2422 /**
2423 * The context in which the result was changed.
2424 */
2425 final AnalysisContext context;
2426
2427 /**
2428 * The target for which the result was changed.
2429 */
2430 final AnalysisTarget target;
2431
2432 /**
2433 * The descriptor of the result which was changed.
2434 */
2435 final ResultDescriptor<V> descriptor;
2436
2437 /**
2438 * If the result [wasComputed], the new value of the result. If the result
2439 * [wasInvalidated], the value of before it was invalidated, may be the
2440 * default value if the result was flushed.
2441 */
2442 final V value;
2443
2444 /**
2445 * Is `true` if the result was computed, or `false` is is was invalidated.
2446 */
2447 final bool _wasComputed;
2448
2449 ResultChangedEvent(this.context, this.target, this.descriptor, this.value,
2450 this._wasComputed);
2451
2452 /**
2453 * Returns `true` if the result was computed.
2454 */
2455 bool get wasComputed => _wasComputed;
2456
2457 /**
2458 * Returns `true` if the result was invalidated.
2459 */
2460 bool get wasInvalidated => !_wasComputed;
2461
2462 @override
2463 String toString() => '$descriptor of $target';
Brian Wilkerson 2016/03/08 20:47:02 " in $context"?
scheglov 2016/03/08 20:53:46 Done.
2464 }
2465
2466 /**
2411 * [SourcesChangedEvent] indicates which sources have been added, removed, 2467 * [SourcesChangedEvent] indicates which sources have been added, removed,
2412 * or whose contents have changed. 2468 * or whose contents have changed.
2413 */ 2469 */
2414 class SourcesChangedEvent { 2470 class SourcesChangedEvent {
2415 /** 2471 /**
2416 * The internal representation of what has changed. Clients should not access 2472 * The internal representation of what has changed. Clients should not access
2417 * this field directly. 2473 * this field directly.
2418 */ 2474 */
2419 final ChangeSet _changeSet; 2475 final ChangeSet _changeSet;
2420 2476
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 * The data that was created from the source. 2535 * The data that was created from the source.
2480 */ 2536 */
2481 final E data; 2537 final E data;
2482 2538
2483 /** 2539 /**
2484 * Initialize a newly created holder to associate the given [data] with the 2540 * Initialize a newly created holder to associate the given [data] with the
2485 * given [modificationTime]. 2541 * given [modificationTime].
2486 */ 2542 */
2487 TimestampedData(this.modificationTime, this.data); 2543 TimestampedData(this.modificationTime, this.data);
2488 } 2544 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698