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

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

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

Powered by Google App Engine
This is Rietveld 408576698