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

Side by Side Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10696192: Transform (x && y) && z into x && (y && z). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 interface Visitor<R> { 5 interface Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCascade(Cascade node); 8 R visitCascade(Cascade node);
9 R visitCascadeReceiver(CascadeReceiver node); 9 R visitCascadeReceiver(CascadeReceiver node);
10 R visitCaseMatch(CaseMatch node); 10 R visitCaseMatch(CaseMatch node);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 bool get isSuperCall() { 275 bool get isSuperCall() {
276 return receiver !== null && 276 return receiver !== null &&
277 receiver.asIdentifier() !== null && 277 receiver.asIdentifier() !== null &&
278 receiver.asIdentifier().isSuper(); 278 receiver.asIdentifier().isSuper();
279 } 279 }
280 bool get isOperator() => selector is Operator; 280 bool get isOperator() => selector is Operator;
281 bool get isPropertyAccess() => argumentsNode === null; 281 bool get isPropertyAccess() => argumentsNode === null;
282 bool get isFunctionObjectInvocation() => selector === null; 282 bool get isFunctionObjectInvocation() => selector === null;
283 bool get isPrefix() => argumentsNode is Prefix; 283 bool get isPrefix() => argumentsNode is Prefix;
284 bool get isPostfix() => argumentsNode is Postfix; 284 bool get isPostfix() => argumentsNode is Postfix;
285 bool get isCall() => !isOperator && !isPropertyAccess;
285 bool get isIndex() => 286 bool get isIndex() =>
286 isOperator && selector.asOperator().source.stringValue === '[]'; 287 isOperator && selector.asOperator().source.stringValue === '[]';
287 bool get isCall() => !isOperator && !isPropertyAccess; 288 bool get isLogicalAnd() =>
289 isOperator && selector.asOperator().source.stringValue === '&&';
290 bool get isLogicalOr() =>
291 isOperator && selector.asOperator().source.stringValue === '||';
288 292
289 Token getBeginToken() { 293 Token getBeginToken() {
290 if (isPrefix && !isIndex) return selector.getBeginToken(); 294 if (isPrefix && !isIndex) return selector.getBeginToken();
291 return firstBeginToken(receiver, selector); 295 return firstBeginToken(receiver, selector);
292 } 296 }
293 297
294 Token getEndToken() { 298 Token getEndToken() {
295 if (isPrefix) { 299 if (isPrefix) {
296 if (receiver !== null) return receiver.getEndToken(); 300 if (receiver !== null) return receiver.getEndToken();
297 if (selector !== null) return selector.getEndToken(); 301 if (selector !== null) return selector.getEndToken();
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 * argument). 1749 * argument).
1746 * 1750 *
1747 * TODO(ahe): This method is controversial, the team needs to discuss 1751 * TODO(ahe): This method is controversial, the team needs to discuss
1748 * if top-level methods are acceptable and what naming conventions to 1752 * if top-level methods are acceptable and what naming conventions to
1749 * use. 1753 * use.
1750 */ 1754 */
1751 initializerDo(Node node, f(Node node)) { 1755 initializerDo(Node node, f(Node node)) {
1752 SendSet send = node.asSendSet(); 1756 SendSet send = node.asSendSet();
1753 if (send !== null) return f(send.arguments.head); 1757 if (send !== null) return f(send.arguments.head);
1754 } 1758 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen_helpers.dart ('k') | tests/compiler/dart2js/ssa_phi_codegen_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698