| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
package org.mozilla.javascript.ast; |
| 8 |
|
| 9 |
import org.mozilla.javascript.Token; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
public class PropertyGet extends InfixExpression { |
| 15 |
|
| 16 |
{ |
| 17 |
type = Token.GETPROP; |
| 18 |
} |
| 19 |
|
| 20 |
public PropertyGet() { |
| 21 |
} |
| 22 |
|
| 23 |
public PropertyGet(int pos) { |
| 24 |
super(pos); |
| 25 |
} |
| 26 |
|
| 27 |
public PropertyGet(int pos, int len) { |
| 28 |
super(pos, len); |
| 29 |
} |
| 30 |
|
| 31 |
public PropertyGet(int pos, int len, AstNode target, Name property) { |
| 32 |
super(pos, len, target, property); |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
public PropertyGet(AstNode target, Name property) { |
| 40 |
super(target, property); |
| 41 |
} |
| 42 |
|
| 43 |
public PropertyGet(AstNode target, Name property, int dotPosition) { |
| 44 |
super(Token.GETPROP, target, property, dotPosition); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
public AstNode getTarget() { |
| 52 |
return getLeft(); |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
public void setTarget(AstNode target) { |
| 62 |
setLeft(target); |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
public Name getProperty() { |
| 69 |
return (Name)getRight(); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
public void setProperty(Name property) { |
| 77 |
setRight(property); |
| 78 |
} |
| 79 |
|
| 80 |
@Override |
| 81 |
public String toSource(int depth) { |
| 82 |
StringBuilder sb = new StringBuilder(); |
| 83 |
sb.append(makeIndent(depth)); |
| 84 |
sb.append(getLeft().toSource(0)); |
| 85 |
sb.append("."); |
| 86 |
sb.append(getRight().toSource(0)); |
| 87 |
return sb.toString(); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
@Override |
| 94 |
public void visit(NodeVisitor v) { |
| 95 |
if (v.visit(this)) { |
| 96 |
getTarget().visit(v); |
| 97 |
getProperty().visit(v); |
| 98 |
} |
| 99 |
} |
| 100 |
} |