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

Side by Side Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1179753002: Add AnalysisDriver.onResultComputed(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | 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) 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.context.context; 5 library analyzer.src.context.context;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/instrumentation/instrumentation.dart'; 10 import 'package:analyzer/instrumentation/instrumentation.dart';
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 _completer.completeError(exception, stackTrace); 1906 _completer.completeError(exception, stackTrace);
1907 } 1907 }
1908 } 1908 }
1909 1909
1910 void _onCancel() { 1910 void _onCancel() {
1911 _context._cancelFuture(this); 1911 _context._cancelFuture(this);
1912 } 1912 }
1913 } 1913 }
1914 1914
1915 /** 1915 /**
1916 * [ResultComputedEvent] describes a value computed for a [ResultDescriptor].
1917 */
1918 class ResultComputedEvent<V> {
1919 /**
1920 * The context in which the value was computed.
1921 */
1922 final AnalysisContext context;
1923
1924 /**
1925 * The descriptor of the result which was computed.
1926 */
1927 final ResultDescriptor<V> descriptor;
1928
1929 /**
1930 * The target for which the result was computed.
1931 */
1932 final AnalysisTarget target;
1933
1934 /**
1935 * The computed value.
1936 */
1937 final V value;
1938
1939 ResultComputedEvent(this.context, this.descriptor, this.target, this.value);
1940
1941 @override
1942 String toString() => '$value for $descriptor of $target in $context';
1943 }
1944
1945 /**
1916 * An [AnalysisContext] that only contains sources for a Dart SDK. 1946 * An [AnalysisContext] that only contains sources for a Dart SDK.
1917 */ 1947 */
1918 class SdkAnalysisContext extends AnalysisContextImpl { 1948 class SdkAnalysisContext extends AnalysisContextImpl {
1919 @override 1949 @override
1920 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { 1950 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) {
1921 if (factory == null) { 1951 if (factory == null) {
1922 return super.createCacheFromSourceFactory(factory); 1952 return super.createCacheFromSourceFactory(factory);
1923 } 1953 }
1924 DartSdk sdk = factory.dartSdk; 1954 DartSdk sdk = factory.dartSdk;
1925 if (sdk == null) { 1955 if (sdk == null) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 PendingFuture pendingFuture = 2001 PendingFuture pendingFuture =
1972 new PendingFuture<T>(_context, target, computeValue); 2002 new PendingFuture<T>(_context, target, computeValue);
1973 if (!pendingFuture.evaluate(entry)) { 2003 if (!pendingFuture.evaluate(entry)) {
1974 _context._pendingFutureTargets 2004 _context._pendingFutureTargets
1975 .putIfAbsent(target, () => <PendingFuture>[]) 2005 .putIfAbsent(target, () => <PendingFuture>[])
1976 .add(pendingFuture); 2006 .add(pendingFuture);
1977 } 2007 }
1978 return pendingFuture.future; 2008 return pendingFuture.future;
1979 } 2009 }
1980 } 2010 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698