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

Side by Side Diff: pkg/compiler/lib/src/resolution/tree_elements.dart

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
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 dart2js.resolution.tree_elements; 5 library dart2js.resolution.tree_elements;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../diagnostics/source_span.dart'; 10 import '../diagnostics/source_span.dart';
11 import '../elements/elements.dart'; 11 import '../elements/elements.dart';
12 import '../types/types.dart' show 12 import '../types/types.dart' show TypeMask;
13 TypeMask;
14 import '../tree/tree.dart'; 13 import '../tree/tree.dart';
15 import '../util/util.dart'; 14 import '../util/util.dart';
16 import '../universe/selector.dart' show 15 import '../universe/selector.dart' show Selector;
17 Selector;
18 16
19 import 'secret_tree_element.dart' show 17 import 'secret_tree_element.dart' show getTreeElement, setTreeElement;
20 getTreeElement,
21 setTreeElement;
22 import 'send_structure.dart'; 18 import 'send_structure.dart';
23 19
24 abstract class TreeElements { 20 abstract class TreeElements {
25 AnalyzableElement get analyzedElement; 21 AnalyzableElement get analyzedElement;
26 Iterable<SourceSpan> get superUses; 22 Iterable<SourceSpan> get superUses;
27 23
28 void forEachConstantNode(f(Node n, ConstantExpression c)); 24 void forEachConstantNode(f(Node n, ConstantExpression c));
29 25
30 Element operator[](Node node); 26 Element operator [](Node node);
31 Map<Node, DartType> get typesCache; 27 Map<Node, DartType> get typesCache;
32 28
33 /// Returns the [SendStructure] that describes the semantics of [node]. 29 /// Returns the [SendStructure] that describes the semantics of [node].
34 SendStructure getSendStructure(Send node); 30 SendStructure getSendStructure(Send node);
35 31
36 /// Returns the [NewStructure] that describes the semantics of [node]. 32 /// Returns the [NewStructure] that describes the semantics of [node].
37 NewStructure getNewStructure(NewExpression node); 33 NewStructure getNewStructure(NewExpression node);
38 34
39 // TODO(johnniwinther): Investigate whether [Node] could be a [Send]. 35 // TODO(johnniwinther): Investigate whether [Node] could be a [Send].
40 Selector getSelector(Node node); 36 Selector getSelector(Node node);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 276
281 List<Node> getPotentialMutationsIn(Node node, VariableElement element) { 277 List<Node> getPotentialMutationsIn(Node node, VariableElement element) {
282 if (_potentiallyMutatedIn == null) return const <Node>[]; 278 if (_potentiallyMutatedIn == null) return const <Node>[];
283 Map<VariableElement, List<Node>> mutationsIn = _potentiallyMutatedIn[node]; 279 Map<VariableElement, List<Node>> mutationsIn = _potentiallyMutatedIn[node];
284 if (mutationsIn == null) return const <Node>[]; 280 if (mutationsIn == null) return const <Node>[];
285 List<Node> mutations = mutationsIn[element]; 281 List<Node> mutations = mutationsIn[element];
286 if (mutations == null) return const <Node>[]; 282 if (mutations == null) return const <Node>[];
287 return mutations; 283 return mutations;
288 } 284 }
289 285
290 void registerPotentialMutationIn(Node contextNode, VariableElement element, 286 void registerPotentialMutationIn(
291 Node mutationNode) { 287 Node contextNode, VariableElement element, Node mutationNode) {
292 if (_potentiallyMutatedIn == null) { 288 if (_potentiallyMutatedIn == null) {
293 _potentiallyMutatedIn = 289 _potentiallyMutatedIn =
294 new Maplet<Node, Map<VariableElement, List<Node>>>(); 290 new Maplet<Node, Map<VariableElement, List<Node>>>();
295 } 291 }
296 Map<VariableElement, List<Node>> mutationMap = 292 Map<VariableElement, List<Node>> mutationMap =
297 _potentiallyMutatedIn.putIfAbsent(contextNode, 293 _potentiallyMutatedIn.putIfAbsent(
298 () => new Maplet<VariableElement, List<Node>>()); 294 contextNode, () => new Maplet<VariableElement, List<Node>>());
299 mutationMap.putIfAbsent(element, () => <Node>[]).add(mutationNode); 295 mutationMap.putIfAbsent(element, () => <Node>[]).add(mutationNode);
300 } 296 }
301 297
302 List<Node> getPotentialMutationsInClosure(VariableElement element) { 298 List<Node> getPotentialMutationsInClosure(VariableElement element) {
303 if (_potentiallyMutatedInClosure == null) return const <Node>[]; 299 if (_potentiallyMutatedInClosure == null) return const <Node>[];
304 List<Node> mutations = _potentiallyMutatedInClosure[element]; 300 List<Node> mutations = _potentiallyMutatedInClosure[element];
305 if (mutations == null) return const <Node>[]; 301 if (mutations == null) return const <Node>[];
306 return mutations; 302 return mutations;
307 } 303 }
308 304
309 void registerPotentialMutationInClosure(VariableElement element, 305 void registerPotentialMutationInClosure(
310 Node mutationNode) { 306 VariableElement element, Node mutationNode) {
311 if (_potentiallyMutatedInClosure == null) { 307 if (_potentiallyMutatedInClosure == null) {
312 _potentiallyMutatedInClosure = new Maplet<VariableElement, List<Node>>(); 308 _potentiallyMutatedInClosure = new Maplet<VariableElement, List<Node>>();
313 } 309 }
314 _potentiallyMutatedInClosure.putIfAbsent( 310 _potentiallyMutatedInClosure
315 element, () => <Node>[]).add(mutationNode); 311 .putIfAbsent(element, () => <Node>[])
312 .add(mutationNode);
316 } 313 }
317 314
318 List<Node> getAccessesByClosureIn(Node node, VariableElement element) { 315 List<Node> getAccessesByClosureIn(Node node, VariableElement element) {
319 if (_accessedByClosureIn == null) return const <Node>[]; 316 if (_accessedByClosureIn == null) return const <Node>[];
320 Map<VariableElement, List<Node>> accessesIn = _accessedByClosureIn[node]; 317 Map<VariableElement, List<Node>> accessesIn = _accessedByClosureIn[node];
321 if (accessesIn == null) return const <Node>[]; 318 if (accessesIn == null) return const <Node>[];
322 List<Node> accesses = accessesIn[element]; 319 List<Node> accesses = accessesIn[element];
323 if (accesses == null) return const <Node>[]; 320 if (accesses == null) return const <Node>[];
324 return accesses; 321 return accesses;
325 } 322 }
326 323
327 void setAccessedByClosureIn(Node contextNode, VariableElement element, 324 void setAccessedByClosureIn(
328 Node accessNode) { 325 Node contextNode, VariableElement element, Node accessNode) {
329 if (_accessedByClosureIn == null) { 326 if (_accessedByClosureIn == null) {
330 _accessedByClosureIn = new Map<Node, Map<VariableElement, List<Node>>>(); 327 _accessedByClosureIn = new Map<Node, Map<VariableElement, List<Node>>>();
331 } 328 }
332 Map<VariableElement, List<Node>> accessMap = 329 Map<VariableElement, List<Node>> accessMap =
333 _accessedByClosureIn.putIfAbsent(contextNode, 330 _accessedByClosureIn.putIfAbsent(
334 () => new Maplet<VariableElement, List<Node>>()); 331 contextNode, () => new Maplet<VariableElement, List<Node>>());
335 accessMap.putIfAbsent(element, () => <Node>[]).add(accessNode); 332 accessMap.putIfAbsent(element, () => <Node>[]).add(accessNode);
336 } 333 }
337 334
338 String toString() => 'TreeElementMapping($analyzedElement)'; 335 String toString() => 'TreeElementMapping($analyzedElement)';
339 336
340 void forEachConstantNode(f(Node n, ConstantExpression c)) { 337 void forEachConstantNode(f(Node n, ConstantExpression c)) {
341 if (_constants != null) { 338 if (_constants != null) {
342 _constants.forEach(f); 339 _constants.forEach(f);
343 } 340 }
344 } 341 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 467 }
471 468
472 void setCurrentTypeMask(ForIn node, TypeMask mask) { 469 void setCurrentTypeMask(ForIn node, TypeMask mask) {
473 _setTypeMask(node.inToken, mask); 470 _setTypeMask(node.inToken, mask);
474 } 471 }
475 472
476 TypeMask getCurrentTypeMask(ForIn node) { 473 TypeMask getCurrentTypeMask(ForIn node) {
477 return _getTypeMask(node.inToken); 474 return _getTypeMask(node.inToken);
478 } 475 }
479 } 476 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/signatures.dart ('k') | pkg/compiler/lib/src/resolution/type_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698