Small refactor

This commit is contained in:
bigguy345 committed 2025-12-26 23:11:12 +02:00
1 parent c591a91857
commit 662d843147
2 files changed
+9 -9

No files matched your search

@@ -806,7 +806,7 @@ public class ScriptDocument {
// Check primitive types first
if (TypeResolver.isPrimitiveType(baseName)) {
return TypeInfo.forPrimitive(baseName);
return TypeInfo.fromPrimitive(baseName);
}
// Check for String (common case)
@@ -1610,12 +1610,12 @@ public class ScriptDocument {
// Character literals
if (expr.startsWith("'") && expr.endsWith("'")) {
return TypeInfo.forPrimitive("char");
return TypeInfo.fromPrimitive("char");
}
// Boolean literals
if (expr.equals("true") || expr.equals("false")) {
return TypeInfo.forPrimitive("boolean");
return TypeInfo.fromPrimitive("boolean");
}
// Null literal
@@ -1626,18 +1626,18 @@ public class ScriptDocument {
// Numeric literals
if (expr.matches("-?\\d+[lL]?")) {
if (expr.toLowerCase().endsWith("l")) {
return TypeInfo.forPrimitive("long");
return TypeInfo.fromPrimitive("long");
}
return TypeInfo.forPrimitive("int");
return TypeInfo.fromPrimitive("int");
}
if (expr.matches("-?\\d+\\.\\d*[fF]?")) {
if (expr.toLowerCase().endsWith("f")) {
return TypeInfo.forPrimitive("float");
return TypeInfo.fromPrimitive("float");
}
return TypeInfo.forPrimitive("double");
return TypeInfo.fromPrimitive("double");
}
if (expr.matches("-?\\d+\\.\\d*[dD]")) {
return TypeInfo.forPrimitive("double");
return TypeInfo.fromPrimitive("double");
}
// "this" keyword
@@ -98,7 +98,7 @@ public class TypeInfo {
/**
* Create a TypeInfo for a primitive type.
*/
public static TypeInfo forPrimitive(String typeName) {
public static TypeInfo fromPrimitive(String typeName) {
Class<?> primitiveClass = null;
switch (typeName) {
case "boolean": primitiveClass = boolean.class; break;