File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
liquidjava-verifier/src/main/java/liquidjava/rj_language/visitors Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -199,10 +199,11 @@ else if (literalContext.STRING() != null)
199199 return new LiteralString (literalContext .STRING ().getText ());
200200 else if (literalContext .INT () != null ) {
201201 String text = literalContext .INT ().getText ();
202- try {
203- return new LiteralInt (text );
204- } catch (NumberFormatException e ) {
205- return new LiteralLong (text );
202+ long value = Long .parseLong (text );
203+ if (value <= Integer .MAX_VALUE && value >= Integer .MIN_VALUE ) {
204+ return new LiteralInt ((int ) value );
205+ } else {
206+ return new LiteralLong (value );
206207 }
207208 } else if (literalContext .REAL () != null )
208209 return new LiteralReal (literalContext .REAL ().getText ());
You can’t perform that action at this time.
0 commit comments