OLD | NEW |
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 '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
9 import '../diagnostics/invariant.dart' show | 9 import '../diagnostics/invariant.dart' show |
10 invariant; | 10 invariant; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 Selector getMoveNextSelector(ForIn node); | 65 Selector getMoveNextSelector(ForIn node); |
66 Selector getCurrentSelector(ForIn node); | 66 Selector getCurrentSelector(ForIn node); |
67 TypeMask getIteratorTypeMask(ForIn node); | 67 TypeMask getIteratorTypeMask(ForIn node); |
68 TypeMask getMoveNextTypeMask(ForIn node); | 68 TypeMask getMoveNextTypeMask(ForIn node); |
69 TypeMask getCurrentTypeMask(ForIn node); | 69 TypeMask getCurrentTypeMask(ForIn node); |
70 void setIteratorTypeMask(ForIn node, TypeMask mask); | 70 void setIteratorTypeMask(ForIn node, TypeMask mask); |
71 void setMoveNextTypeMask(ForIn node, TypeMask mask); | 71 void setMoveNextTypeMask(ForIn node, TypeMask mask); |
72 void setCurrentTypeMask(ForIn node, TypeMask mask); | 72 void setCurrentTypeMask(ForIn node, TypeMask mask); |
73 void setConstant(Node node, ConstantExpression constant); | 73 void setConstant(Node node, ConstantExpression constant); |
74 ConstantExpression getConstant(Node node); | 74 ConstantExpression getConstant(Node node); |
75 bool isAssert(Send send); | |
76 | 75 |
77 /// Returns the [FunctionElement] defined by [node]. | 76 /// Returns the [FunctionElement] defined by [node]. |
78 FunctionElement getFunctionDefinition(FunctionExpression node); | 77 FunctionElement getFunctionDefinition(FunctionExpression node); |
79 | 78 |
80 /// Returns target constructor for the redirecting factory body [node]. | 79 /// Returns target constructor for the redirecting factory body [node]. |
81 ConstructorElement getRedirectingTargetConstructor( | 80 ConstructorElement getRedirectingTargetConstructor( |
82 RedirectingFactoryBody node); | 81 RedirectingFactoryBody node); |
83 | 82 |
84 /** | 83 /** |
85 * Returns [:true:] if [node] is a type literal. | 84 * Returns [:true:] if [node] is a type literal. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Map<Spannable, TypeMask> _typeMasks; | 133 Map<Spannable, TypeMask> _typeMasks; |
135 Map<Node, DartType> _types; | 134 Map<Node, DartType> _types; |
136 Setlet<Node> _superUses; | 135 Setlet<Node> _superUses; |
137 Setlet<Element> _otherDependencies; | 136 Setlet<Element> _otherDependencies; |
138 Map<Node, ConstantExpression> _constants; | 137 Map<Node, ConstantExpression> _constants; |
139 Map<VariableElement, List<Node>> _potentiallyMutated; | 138 Map<VariableElement, List<Node>> _potentiallyMutated; |
140 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn; | 139 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn; |
141 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure; | 140 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure; |
142 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn; | 141 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn; |
143 Setlet<Element> _elements; | 142 Setlet<Element> _elements; |
144 Setlet<Send> _asserts; | |
145 Maplet<Send, SendStructure> _sendStructureMap; | 143 Maplet<Send, SendStructure> _sendStructureMap; |
146 Setlet<DartType> _requiredTypes; | 144 Setlet<DartType> _requiredTypes; |
147 bool containsTryStatement = false; | 145 bool containsTryStatement = false; |
148 | 146 |
149 /// Map from nodes to the targets they define. | 147 /// Map from nodes to the targets they define. |
150 Map<Node, JumpTarget> _definedTargets; | 148 Map<Node, JumpTarget> _definedTargets; |
151 | 149 |
152 /// Map from goto statements to their targets. | 150 /// Map from goto statements to their targets. |
153 Map<GotoStatement, JumpTarget> _usedTargets; | 151 Map<GotoStatement, JumpTarget> _usedTargets; |
154 | 152 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 Iterable<Element> get allElements { | 404 Iterable<Element> get allElements { |
407 return _elements != null ? _elements : const <Element>[]; | 405 return _elements != null ? _elements : const <Element>[]; |
408 } | 406 } |
409 | 407 |
410 void forEachConstantNode(f(Node n, ConstantExpression c)) { | 408 void forEachConstantNode(f(Node n, ConstantExpression c)) { |
411 if (_constants != null) { | 409 if (_constants != null) { |
412 _constants.forEach(f); | 410 _constants.forEach(f); |
413 } | 411 } |
414 } | 412 } |
415 | 413 |
416 void setAssert(Send node) { | |
417 if (_asserts == null) { | |
418 _asserts = new Setlet<Send>(); | |
419 } | |
420 _asserts.add(node); | |
421 } | |
422 | |
423 bool isAssert(Send node) { | |
424 return _asserts != null && _asserts.contains(node); | |
425 } | |
426 | |
427 FunctionElement getFunctionDefinition(FunctionExpression node) { | 414 FunctionElement getFunctionDefinition(FunctionExpression node) { |
428 return this[node]; | 415 return this[node]; |
429 } | 416 } |
430 | 417 |
431 ConstructorElement getRedirectingTargetConstructor( | 418 ConstructorElement getRedirectingTargetConstructor( |
432 RedirectingFactoryBody node) { | 419 RedirectingFactoryBody node) { |
433 return this[node]; | 420 return this[node]; |
434 } | 421 } |
435 | 422 |
436 void defineTarget(Node node, JumpTarget target) { | 423 void defineTarget(Node node, JumpTarget target) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 538 } |
552 | 539 |
553 void setCurrentTypeMask(ForIn node, TypeMask mask) { | 540 void setCurrentTypeMask(ForIn node, TypeMask mask) { |
554 _setTypeMask(node.inToken, mask); | 541 _setTypeMask(node.inToken, mask); |
555 } | 542 } |
556 | 543 |
557 TypeMask getCurrentTypeMask(ForIn node) { | 544 TypeMask getCurrentTypeMask(ForIn node) { |
558 return _getTypeMask(node.inToken); | 545 return _getTypeMask(node.inToken); |
559 } | 546 } |
560 } | 547 } |
OLD | NEW |