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

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

Issue 1212503004: Tighten up dependencies in the task model. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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/test/src/task/dart_test.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.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:analyzer/src/context/cache.dart'; 10 import 'package:analyzer/src/context/cache.dart';
(...skipping 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 } 3086 }
3087 3087
3088 /** 3088 /**
3089 * Return a map from the names of the inputs of this kind of task to the task 3089 * Return a map from the names of the inputs of this kind of task to the task
3090 * input descriptors describing those inputs for a task with the 3090 * input descriptors describing those inputs for a task with the
3091 * given [target]. 3091 * given [target].
3092 */ 3092 */
3093 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3093 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3094 Source source = target; 3094 Source source = target;
3095 return <String, TaskInput>{ 3095 return <String, TaskInput>{
3096 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source), 3096 'resolvedUnit': UNITS.of(source).toList((Source unit) =>
3097 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE 3097 RESOLVED_UNIT3.of(new LibrarySpecificUnit(source, unit))),
3098 .of(source) 3098 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source)
3099 .toMapOf(UNITS)
3100 .toFlattenList((Source library, Source unit) =>
3101 RESOLVED_UNIT3.of(new LibrarySpecificUnit(library, unit))),
3102 }; 3099 };
3103 } 3100 }
3104 3101
3105 /** 3102 /**
3106 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in 3103 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in
3107 * the given [context]. 3104 * the given [context].
3108 */ 3105 */
3109 static ResolveLibraryTypeNamesTask createTask( 3106 static ResolveLibraryTypeNamesTask createTask(
3110 AnalysisContext context, AnalysisTarget target) { 3107 AnalysisContext context, AnalysisTarget target) {
3111 return new ResolveLibraryTypeNamesTask(context, target); 3108 return new ResolveLibraryTypeNamesTask(context, target);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 } 3172 }
3176 3173
3177 /** 3174 /**
3178 * Return a map from the names of the inputs of this kind of task to the task 3175 * Return a map from the names of the inputs of this kind of task to the task
3179 * input descriptors describing those inputs for a task with the 3176 * input descriptors describing those inputs for a task with the
3180 * given [target]. 3177 * given [target].
3181 */ 3178 */
3182 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3179 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3183 LibrarySpecificUnit unit = target; 3180 LibrarySpecificUnit unit = target;
3184 return <String, TaskInput>{ 3181 return <String, TaskInput>{
3182 'fullyBuiltLibraryElements': IMPORT_EXPORT_SOURCE_CLOSURE
3183 .of(unit.library)
3184 .toListOf(LIBRARY_ELEMENT6),
3185 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library), 3185 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library),
3186 UNIT_INPUT: RESOLVED_UNIT4.of(unit), 3186 UNIT_INPUT: RESOLVED_UNIT4.of(unit),
3187 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) 3187 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
3188 }; 3188 };
3189 } 3189 }
3190 3190
3191 /** 3191 /**
3192 * Create a [ResolveUnitReferencesTask] based on the given [target] in 3192 * Create a [ResolveUnitReferencesTask] based on the given [target] in
3193 * the given [context]. 3193 * the given [context].
3194 */ 3194 */
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3342 } 3342 }
3343 3343
3344 /** 3344 /**
3345 * Return a map from the names of the inputs of this kind of task to the task 3345 * Return a map from the names of the inputs of this kind of task to the task
3346 * input descriptors describing those inputs for a task with the 3346 * input descriptors describing those inputs for a task with the
3347 * given [target]. 3347 * given [target].
3348 */ 3348 */
3349 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3349 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3350 LibrarySpecificUnit unit = target; 3350 LibrarySpecificUnit unit = target;
3351 return <String, TaskInput>{ 3351 return <String, TaskInput>{
3352 'fullyBuiltLibraryElements': IMPORT_EXPORT_SOURCE_CLOSURE 3352 LIBRARY_INPUT: LIBRARY_ELEMENT1.of(unit.library),
3353 .of(unit.library) 3353 UNIT_INPUT: RESOLVED_UNIT1.of(unit),
3354 .toListOf(LIBRARY_ELEMENT6),
3355 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library),
3356 UNIT_INPUT: RESOLVED_UNIT3.of(unit),
3357 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) 3354 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
3358 }; 3355 };
3359 } 3356 }
3360 3357
3361 /** 3358 /**
3362 * Create a [ResolveVariableReferencesTask] based on the given [target] in 3359 * Create a [ResolveVariableReferencesTask] based on the given [target] in
3363 * the given [context]. 3360 * the given [context].
3364 */ 3361 */
3365 static ResolveVariableReferencesTask createTask( 3362 static ResolveVariableReferencesTask createTask(
3366 AnalysisContext context, AnalysisTarget target) { 3363 AnalysisContext context, AnalysisTarget target) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3398 TaskDescriptor get descriptor => DESCRIPTOR; 3395 TaskDescriptor get descriptor => DESCRIPTOR;
3399 3396
3400 @override 3397 @override
3401 void internalPerform() { 3398 void internalPerform() {
3402 Source source = getRequiredSource(); 3399 Source source = getRequiredSource();
3403 3400
3404 RecordingErrorListener errorListener = new RecordingErrorListener(); 3401 RecordingErrorListener errorListener = new RecordingErrorListener();
3405 if (context.getModificationStamp(target.source) < 0) { 3402 if (context.getModificationStamp(target.source) < 0) {
3406 String message = 'Content could not be read'; 3403 String message = 'Content could not be read';
3407 if (context is InternalAnalysisContext) { 3404 if (context is InternalAnalysisContext) {
3408 CacheEntry entry = (context as InternalAnalysisContext).getCacheEntry(ta rget); 3405 CacheEntry entry =
3406 (context as InternalAnalysisContext).getCacheEntry(target);
3409 CaughtException exception = entry.exception; 3407 CaughtException exception = entry.exception;
3410 if (exception != null) { 3408 if (exception != null) {
3411 message = exception.toString(); 3409 message = exception.toString();
3412 } 3410 }
3413 } 3411 }
3414 errorListener.onError(new AnalysisError( 3412 errorListener.onError(new AnalysisError(
3415 source, 0, 0, ScannerErrorCode.UNABLE_GET_CONTENT, [message])); 3413 source, 0, 0, ScannerErrorCode.UNABLE_GET_CONTENT, [message]));
3416 } 3414 }
3417 if (target is DartScript) { 3415 if (target is DartScript) {
3418 DartScript script = target; 3416 DartScript script = target;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
3706 3704
3707 @override 3705 @override
3708 bool moveNext() { 3706 bool moveNext() {
3709 if (_newSources.isEmpty) { 3707 if (_newSources.isEmpty) {
3710 return false; 3708 return false;
3711 } 3709 }
3712 currentTarget = _newSources.removeLast(); 3710 currentTarget = _newSources.removeLast();
3713 return true; 3711 return true;
3714 } 3712 }
3715 } 3713 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698