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

Side by Side Diff: compiler/java/com/google/dart/compiler/ast/DartUnaryExpression.java

Issue 9597025: Removes unused 'normalized' field in many AST nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
« no previous file with comments | « compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.ast; 5 package com.google.dart.compiler.ast;
6 6
7 import com.google.dart.compiler.parser.Token; 7 import com.google.dart.compiler.parser.Token;
8 import com.google.dart.compiler.resolver.Element; 8 import com.google.dart.compiler.resolver.Element;
9 9
10 /** 10 /**
11 * Represents a Dart unary expression. 11 * Represents a Dart unary expression.
12 */ 12 */
13 public class DartUnaryExpression extends DartExpression implements ElementRefere nce { 13 public class DartUnaryExpression extends DartExpression implements ElementRefere nce {
14 14
15 private final Token operator; 15 private final Token operator;
16 private DartExpression arg; 16 private DartExpression arg;
17 private final boolean isPrefix; 17 private final boolean isPrefix;
18 private DartExpression normalizedNode = this;
19 private Element referencedElement; 18 private Element referencedElement;
20 19
21 public DartUnaryExpression(Token operator, DartExpression arg, boolean isPrefi x) { 20 public DartUnaryExpression(Token operator, DartExpression arg, boolean isPrefi x) {
22 assert operator.isUnaryOperator() || operator == Token.SUB; 21 assert operator.isUnaryOperator() || operator == Token.SUB;
23 22
24 this.isPrefix = isPrefix; 23 this.isPrefix = isPrefix;
25 this.operator = operator; 24 this.operator = operator;
26 this.arg = becomeParentOf(arg); 25 this.arg = becomeParentOf(arg);
27 } 26 }
28 27
29 public DartExpression getArg() { 28 public DartExpression getArg() {
30 return arg; 29 return arg;
31 } 30 }
32 31
33 public Token getOperator() { 32 public Token getOperator() {
34 return operator; 33 return operator;
35 } 34 }
36 35
37 public boolean isPrefix() { 36 public boolean isPrefix() {
38 return isPrefix; 37 return isPrefix;
39 } 38 }
40 39
41 public void setNormalizedNode(DartExpression normalizedNode) {
42 normalizedNode.setSourceInfo(this);
43 this.normalizedNode = normalizedNode;
44 }
45
46 @Override
47 public DartExpression getNormalizedNode() {
48 return normalizedNode;
49 }
50
51 @Override 40 @Override
52 public void traverse(DartVisitor v, DartContext ctx) { 41 public void traverse(DartVisitor v, DartContext ctx) {
53 if (v.visit(this, ctx)) { 42 if (v.visit(this, ctx)) {
54 if (operator.isCountOperator()) { 43 if (operator.isCountOperator()) {
55 arg = becomeParentOf(v.acceptLvalue(getArg())); 44 arg = becomeParentOf(v.acceptLvalue(getArg()));
56 } else { 45 } else {
57 arg = becomeParentOf(v.accept(getArg())); 46 arg = becomeParentOf(v.accept(getArg()));
58 } 47 }
59 } 48 }
60 v.endVisit(this, ctx); 49 v.endVisit(this, ctx);
(...skipping 12 matching lines...) Expand all
73 @Override 62 @Override
74 public Element getReferencedElement() { 63 public Element getReferencedElement() {
75 return referencedElement; 64 return referencedElement;
76 } 65 }
77 66
78 @Override 67 @Override
79 public void setReferencedElement(Element referencedElement) { 68 public void setReferencedElement(Element referencedElement) {
80 this.referencedElement = referencedElement; 69 this.referencedElement = referencedElement;
81 } 70 }
82 } 71 }
OLDNEW
« no previous file with comments | « compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698