@@ -49,8 +49,8 @@ public final class StaticVar extends StaticDecl {
49
49
50
50
@ Override
51
51
public void compile (final QueryContext qc ) throws QueryException {
52
- if (expr == null ) throw VAREMPTY_X .get (info , '$' + Token . string ( name . string () ));
53
- if (dontEnter ) throw circVarError ( this );
52
+ if (expr == null ) throw VAREMPTY_X .get (info , name ( ));
53
+ if (dontEnter ) throw CIRCVAR_X . get ( info , name () );
54
54
55
55
if (!compiled ) {
56
56
dontEnter = true ;
@@ -80,12 +80,12 @@ public void compile(final QueryContext qc) throws QueryException {
80
80
* @throws QueryException query exception
81
81
*/
82
82
Value value (final QueryContext qc ) throws QueryException {
83
- if (dontEnter ) throw circVarError ( this );
83
+ if (dontEnter ) throw CIRCVAR_X . get ( info , name () );
84
84
85
85
if (lazy ) {
86
86
if (!compiled ) throw Util .notExpected (this + " was not compiled." );
87
87
} else {
88
- if (expr == null ) throw VAREMPTY_X .get (info , this );
88
+ if (expr == null ) throw VAREMPTY_X .get (info , name () );
89
89
}
90
90
91
91
if (val != null ) return val ;
@@ -150,7 +150,7 @@ public boolean visit(final ASTVisitor visitor) {
150
150
@ Override
151
151
public String toString () {
152
152
final TokenBuilder tb = new TokenBuilder (DECLARE ).add (' ' ).addExt (anns );
153
- tb .add (VARIABLE ).add (' ' ).add (DOLLAR ). add ( name . string ());
153
+ tb .add (VARIABLE ).add (' ' ).add (name ());
154
154
if (type != null ) tb .add (' ' ).add (AS ).add (' ' ).addExt (type );
155
155
if (external ) tb .add (' ' ).add (EXTERNAL );
156
156
if (expr != null ) tb .add (' ' ).add (ASSIGN ).add (' ' ).addExt (expr );
@@ -162,6 +162,14 @@ public byte[] id() {
162
162
return Token .concat (new byte [] { '$' }, name .id ());
163
163
}
164
164
165
+ /**
166
+ * Returns the name of the variable.
167
+ * @return name
168
+ */
169
+ private String name () {
170
+ return new TokenBuilder ().add (DOLLAR ).add (name .string ()).toString ();
171
+ }
172
+
165
173
/**
166
174
* Checks if the expression bound to this variable has the given flag.
167
175
* @param flag flag to check for
0 commit comments