1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
package com.sun.tools.javafx.tree; |
27 | |
|
28 | |
import com.sun.javafx.api.tree.JavaFXTree.JavaFXKind; |
29 | |
import com.sun.javafx.api.tree.JavaFXTreeVisitor; |
30 | |
import com.sun.javafx.api.tree.OnReplaceTree; |
31 | |
import com.sun.tools.javac.code.Symbol.VarSymbol; |
32 | |
import com.sun.tools.javac.util.Name; |
33 | |
import com.sun.tools.javac.tree.JCTree.JCModifiers; |
34 | |
import com.sun.tools.javac.tree.JCTree.JCVariableDecl; |
35 | |
import com.sun.javafx.api.JavafxBindStatus; |
36 | |
import com.sun.javafx.api.tree.JavaFXVariableTree; |
37 | |
import com.sun.source.tree.TreeVisitor; |
38 | |
import com.sun.tools.javac.tree.JCTree; |
39 | |
import java.util.Map; |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | 7 | public class JFXVar extends JCVariableDecl implements JavaFXVariableTree { |
48 | |
private JFXType jfxtype; |
49 | |
private final JavafxBindStatus bindStatus; |
50 | |
private final boolean local; |
51 | |
|
52 | |
private final JFXOnReplace onReplace; |
53 | |
|
54 | |
protected JFXVar(Name name, |
55 | |
JFXType jfxtype, |
56 | |
JCModifiers mods, |
57 | |
boolean local, |
58 | |
JCExpression init, |
59 | |
JavafxBindStatus bindStat, |
60 | |
JFXOnReplace onReplace, |
61 | |
VarSymbol sym) { |
62 | 3282 | super(mods, name, jfxtype, init, sym); |
63 | 3282 | this.local = local; |
64 | 3282 | this.jfxtype = jfxtype; |
65 | 3282 | this.bindStatus = bindStat == null ? JavafxBindStatus.UNBOUND : bindStat; |
66 | 3282 | this.onReplace = onReplace; |
67 | 3282 | this.sym = sym; |
68 | 3282 | } |
69 | |
|
70 | 21505 | public void accept(JavafxVisitor v) { v.visitVar(this); } |
71 | |
|
72 | |
@Override |
73 | |
public void accept(Visitor v) { |
74 | 21505 | if (v instanceof JavafxVisitor) { |
75 | 21505 | this.accept((JavafxVisitor)v); |
76 | |
} else { |
77 | 0 | v.visitVarDef(this); |
78 | |
} |
79 | 21502 | } |
80 | |
|
81 | |
public JFXType getJFXType() { |
82 | 14775 | return jfxtype; |
83 | |
} |
84 | |
|
85 | |
public void setJFXType(JFXType type) { |
86 | 223 | jfxtype = type; |
87 | 223 | } |
88 | |
|
89 | |
public OnReplaceTree getOnReplaceTree() { |
90 | 7 | return onReplace; |
91 | |
} |
92 | |
|
93 | |
public JFXOnReplace getOnReplace() { |
94 | 19971 | return onReplace; |
95 | |
} |
96 | |
|
97 | |
public boolean isLocal() { |
98 | 15 | return local; |
99 | |
} |
100 | |
|
101 | |
public JavafxBindStatus getBindStatus() { |
102 | 1746 | return bindStatus; |
103 | |
} |
104 | |
|
105 | |
public boolean isBound() { |
106 | 3264 | return bindStatus.isBound(); |
107 | |
} |
108 | |
|
109 | |
public boolean isUnidiBind() { |
110 | 0 | return bindStatus.isUnidiBind(); |
111 | |
} |
112 | |
|
113 | |
public boolean isBidiBind() { |
114 | 0 | return bindStatus.isBidiBind(); |
115 | |
} |
116 | |
|
117 | |
public boolean isLazy() { |
118 | 0 | return bindStatus.isLazy(); |
119 | |
} |
120 | |
|
121 | |
@Override |
122 | |
public int getTag() { |
123 | 50681 | return JavafxTag.VAR_DEF; |
124 | |
} |
125 | |
|
126 | |
public JCModifiers getModifiers() { |
127 | 4441 | return mods; |
128 | |
} |
129 | |
|
130 | |
|
131 | |
public boolean isOverride() { |
132 | 0 | return false; |
133 | |
} |
134 | |
|
135 | |
public JavaFXKind getJavaFXKind() { |
136 | 0 | throw new UnsupportedOperationException(getClass().getSimpleName() + " support not implemented"); |
137 | |
} |
138 | |
|
139 | |
public <R, D> R accept(JavaFXTreeVisitor<R, D> visitor, D data) { |
140 | 7 | return visitor.visitVariable(this, data); |
141 | |
} |
142 | |
|
143 | |
@Override |
144 | |
public final <R, D> R accept(TreeVisitor<R, D> v, D d) { |
145 | 7 | if (v instanceof JavaFXTreeVisitor) { |
146 | 7 | return (R)this.accept((JavaFXTreeVisitor)v, d); |
147 | |
} else { |
148 | 0 | throw new UnsupportedOperationException(getClass().getSimpleName() + " support not implemented"); |
149 | |
} |
150 | |
} |
151 | |
|
152 | |
@Override |
153 | |
public int getStartPosition() { |
154 | 46412 | return JavafxTreeInfo.getStartPos(this); |
155 | |
} |
156 | |
|
157 | |
@Override |
158 | |
public int getEndPosition(Map<JCTree, Integer> endPosTable) { |
159 | 0 | return JavafxTreeInfo.getEndPos(this, endPosTable); |
160 | |
} |
161 | |
} |