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

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

Issue 1053673008: Initial re-write of analysis context for the new task model (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
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.manager; 5 library analyzer.src.task.manager;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/generated/java_engine.dart'; 9 import 'package:analyzer/src/generated/java_engine.dart';
10 import 'package:analyzer/task/model.dart'; 10 import 'package:analyzer/task/model.dart';
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 List<TaskDescriptor> descriptors = taskMap[result]; 60 List<TaskDescriptor> descriptors = taskMap[result];
61 if (descriptors == null) { 61 if (descriptors == null) {
62 descriptors = <TaskDescriptor>[]; 62 descriptors = <TaskDescriptor>[];
63 taskMap[result] = descriptors; 63 taskMap[result] = descriptors;
64 } 64 }
65 descriptors.add(descriptor); 65 descriptors.add(descriptor);
66 }); 66 });
67 } 67 }
68 68
69 /** 69 /**
70 * Add the task descriptors in the given list of [descriptors] to the list of
71 * analysis task descriptors that can be used to compute analysis results.
72 */
73 void addTaskDescriptors(List<TaskDescriptor> descriptors) {
74 descriptors.forEach(addTaskDescriptor);
75 }
76
77 /**
70 * Find a task that will compute the given [result] for the given [target]. 78 * Find a task that will compute the given [result] for the given [target].
71 */ 79 */
72 TaskDescriptor findTask(AnalysisTarget target, ResultDescriptor result) { 80 TaskDescriptor findTask(AnalysisTarget target, ResultDescriptor result) {
73 List<TaskDescriptor> descriptors = taskMap[result]; 81 List<TaskDescriptor> descriptors = taskMap[result];
74 if (descriptors == null) { 82 if (descriptors == null) {
75 throw new AnalysisException( 83 throw new AnalysisException(
76 'No tasks registered to compute $result for $target'); 84 'No tasks registered to compute $result for $target');
77 } 85 }
78 return _findBestTask(descriptors); 86 return _findBestTask(descriptors);
79 } 87 }
(...skipping 17 matching lines...) Expand all
97 /** 105 /**
98 * Given a list of task [descriptors] that can be used to compute some 106 * Given a list of task [descriptors] that can be used to compute some
99 * unspecified result, return the descriptor that will compute the result with 107 * unspecified result, return the descriptor that will compute the result with
100 * the least amount of work. 108 * the least amount of work.
101 */ 109 */
102 TaskDescriptor _findBestTask(List<TaskDescriptor> descriptors) { 110 TaskDescriptor _findBestTask(List<TaskDescriptor> descriptors) {
103 // TODO(brianwilkerson) Improve this implementation. 111 // TODO(brianwilkerson) Improve this implementation.
104 return descriptors[0]; 112 return descriptors[0];
105 } 113 }
106 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698