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

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: Address comments 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 Map<Spannable, TypeMask> _typeMasks; 129 Map<Spannable, TypeMask> _typeMasks;
131 Map<Node, DartType> _types; 130 Map<Node, DartType> _types;
132 Setlet<Node> _superUses; 131 Setlet<Node> _superUses;
133 Setlet<Element> _otherDependencies; 132 Setlet<Element> _otherDependencies;
134 Map<Node, ConstantExpression> _constants; 133 Map<Node, ConstantExpression> _constants;
135 Map<VariableElement, List<Node>> _potentiallyMutated; 134 Map<VariableElement, List<Node>> _potentiallyMutated;
136 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn; 135 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn;
137 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure; 136 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure;
138 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn; 137 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn;
139 Setlet<Element> _elements; 138 Setlet<Element> _elements;
140 Setlet<Send> _asserts;
141 Maplet<Send, SendStructure> _sendStructureMap; 139 Maplet<Send, SendStructure> _sendStructureMap;
142 Setlet<DartType> _requiredTypes; 140 Setlet<DartType> _requiredTypes;
143 141
144 /// Map from nodes to the targets they define. 142 /// Map from nodes to the targets they define.
145 Map<Node, JumpTarget> _definedTargets; 143 Map<Node, JumpTarget> _definedTargets;
146 144
147 /// Map from goto statements to their targets. 145 /// Map from goto statements to their targets.
148 Map<GotoStatement, JumpTarget> _usedTargets; 146 Map<GotoStatement, JumpTarget> _usedTargets;
149 147
150 /// Map from labels to their label definition. 148 /// Map from labels to their label definition.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 Iterable<Element> get allElements { 399 Iterable<Element> get allElements {
402 return _elements != null ? _elements : const <Element>[]; 400 return _elements != null ? _elements : const <Element>[];
403 } 401 }
404 402
405 void forEachConstantNode(f(Node n, ConstantExpression c)) { 403 void forEachConstantNode(f(Node n, ConstantExpression c)) {
406 if (_constants != null) { 404 if (_constants != null) {
407 _constants.forEach(f); 405 _constants.forEach(f);
408 } 406 }
409 } 407 }
410 408
411 void setAssert(Send node) {
412 if (_asserts == null) {
413 _asserts = new Setlet<Send>();
414 }
415 _asserts.add(node);
416 }
417
418 bool isAssert(Send node) {
419 return _asserts != null && _asserts.contains(node);
420 }
421
422 FunctionElement getFunctionDefinition(FunctionExpression node) { 409 FunctionElement getFunctionDefinition(FunctionExpression node) {
423 return this[node]; 410 return this[node];
424 } 411 }
425 412
426 ConstructorElement getRedirectingTargetConstructor( 413 ConstructorElement getRedirectingTargetConstructor(
427 RedirectingFactoryBody node) { 414 RedirectingFactoryBody node) {
428 return this[node]; 415 return this[node];
429 } 416 }
430 417
431 void defineTarget(Node node, JumpTarget target) { 418 void defineTarget(Node node, JumpTarget target) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 533 }
547 534
548 void setCurrentTypeMask(ForIn node, TypeMask mask) { 535 void setCurrentTypeMask(ForIn node, TypeMask mask) {
549 _setTypeMask(node.inToken, mask); 536 _setTypeMask(node.inToken, mask);
550 } 537 }
551 538
552 TypeMask getCurrentTypeMask(ForIn node) { 539 TypeMask getCurrentTypeMask(ForIn node) {
553 return _getTypeMask(node.inToken); 540 return _getTypeMask(node.inToken);
554 } 541 }
555 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698