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

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

Issue 1383043002: Stop defensively copying AST structures before resolution (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/task/inputs.dart ('k') | pkg/analyzer/lib/task/model.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.model; 5 library analyzer.src.task.model;
6 6
7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; 7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
8 import 'package:analyzer/src/task/inputs.dart'; 8 import 'package:analyzer/src/task/inputs.dart';
9 import 'package:analyzer/task/model.dart'; 9 import 'package:analyzer/task/model.dart';
10 10
(...skipping 11 matching lines...) Expand all
22 /** 22 /**
23 * Initialize a newly created analysis result to have the given [name] and 23 * Initialize a newly created analysis result to have the given [name] and
24 * [defaultValue]. If a [cachingPolicy] is provided, it will control how long 24 * [defaultValue]. If a [cachingPolicy] is provided, it will control how long
25 * values associated with this result will remain in the cache. 25 * values associated with this result will remain in the cache.
26 */ 26 */
27 ListResultDescriptorImpl(String name, List<E> defaultValue, 27 ListResultDescriptorImpl(String name, List<E> defaultValue,
28 {ResultCachingPolicy<List<E>> cachingPolicy: DEFAULT_CACHING_POLICY}) 28 {ResultCachingPolicy<List<E>> cachingPolicy: DEFAULT_CACHING_POLICY})
29 : super(name, defaultValue, cachingPolicy: cachingPolicy); 29 : super(name, defaultValue, cachingPolicy: cachingPolicy);
30 30
31 @override 31 @override
32 ListTaskInput<E> of(AnalysisTarget target) => 32 ListTaskInput<E> of(AnalysisTarget target, {bool flushOnAccess: false}) {
33 new ListTaskInputImpl<E>(target, this); 33 if (flushOnAccess) {
34 throw new StateError('Cannot flush a list of values');
35 }
36 return new ListTaskInputImpl<E>(target, this);
37 }
34 } 38 }
35 39
36 /** 40 /**
37 * A concrete implementation of a [ResultDescriptor]. 41 * A concrete implementation of a [ResultDescriptor].
38 */ 42 */
39 class ResultDescriptorImpl<V> implements ResultDescriptor<V> { 43 class ResultDescriptorImpl<V> implements ResultDescriptor<V> {
40 static int _NEXT_HASH = 0; 44 static int _NEXT_HASH = 0;
41 45
42 @override 46 @override
43 final hashCode = _NEXT_HASH++; 47 final hashCode = _NEXT_HASH++;
(...skipping 20 matching lines...) Expand all
64 */ 68 */
65 ResultDescriptorImpl(this.name, this.defaultValue, 69 ResultDescriptorImpl(this.name, this.defaultValue,
66 {this.cachingPolicy: DEFAULT_CACHING_POLICY}); 70 {this.cachingPolicy: DEFAULT_CACHING_POLICY});
67 71
68 @override 72 @override
69 bool operator ==(Object other) { 73 bool operator ==(Object other) {
70 return other is ResultDescriptorImpl && other.hashCode == hashCode; 74 return other is ResultDescriptorImpl && other.hashCode == hashCode;
71 } 75 }
72 76
73 @override 77 @override
74 TaskInput<V> of(AnalysisTarget target) => 78 TaskInput<V> of(AnalysisTarget target, {bool flushOnAccess: false}) =>
75 new SimpleTaskInput<V>(target, this); 79 new SimpleTaskInput<V>(target, this, flushOnAccess: flushOnAccess);
76 80
77 @override 81 @override
78 String toString() => name; 82 String toString() => name;
79 } 83 }
80 84
81 /** 85 /**
82 * A simple [ResultCachingPolicy] implementation that consider all the objects 86 * A simple [ResultCachingPolicy] implementation that consider all the objects
83 * to be of the size `1`. 87 * to be of the size `1`.
84 */ 88 */
85 class SimpleResultCachingPolicy<T> implements ResultCachingPolicy<T> { 89 class SimpleResultCachingPolicy<T> implements ResultCachingPolicy<T> {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target, 138 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target,
135 Map<String, dynamic> inputs) { 139 Map<String, dynamic> inputs) {
136 AnalysisTask task = buildTask(context, target); 140 AnalysisTask task = buildTask(context, target);
137 task.inputs = inputs; 141 task.inputs = inputs;
138 return task; 142 return task;
139 } 143 }
140 144
141 @override 145 @override
142 String toString() => name; 146 String toString() => name;
143 } 147 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/inputs.dart ('k') | pkg/analyzer/lib/task/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698