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