File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
liquidjava-verifier/src/main/java/liquidjava/rj_language/visitors Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,25 @@ private Expression literalExpressionCreate(ParseTree rc) throws LJError {
154154 return new GroupExpression (create (((LitGroupContext ) rc ).literalExpression ()));
155155 else if (rc instanceof LitContext )
156156 return create (((LitContext ) rc ).literal ());
157+
158+ // else if (rc instanceof VarContext) {
159+ // return new Var(((VarContext) rc).ID().getText());
160+ // }
157161 else if (rc instanceof VarContext ) {
158- return new Var (((VarContext ) rc ).ID ().getText ());
159- } else if (rc instanceof TargetInvocationContext ) {
162+ // Normalize return-value identifiers:
163+ // - "return" (legacy syntax)
164+ // - "_" (current shorthand)
165+ // Both are mapped to "$result", the canonical return value identifier.
166+ String name = ((VarContext ) rc ).ID ().getText ();
167+
168+ if (name .equals ("return" ) || name .equals ("_" )) {
169+ name = "$result" ;
170+ }
171+
172+ return new Var (name );
173+ }
174+
175+ else if (rc instanceof TargetInvocationContext ) {
160176 // TODO Finish Invocation with Target (a.len())
161177 return null ;
162178 } else {
You can’t perform that action at this time.
0 commit comments