@@ -43,6 +43,7 @@ enum class RsPrimitiveType(val literal: String, val referencable: Boolean = true
43
43
DBCOLUMN (" dbcolumn" ),
44
44
PLAYER_UID (" player_uid" ),
45
45
STRINGVECTOR (" stringvector" ),
46
+
46
47
// Non-Referencable types
47
48
PARAM (" param" , referencable = false ),
48
49
FLO (" flo" , referencable = false ),
@@ -55,25 +56,39 @@ enum class RsPrimitiveType(val literal: String, val referencable: Boolean = true
55
56
VARPHOOK (" varphook" , referencable = false ),
56
57
STATHOOK (" stathook" , referencable = false ),
57
58
INVHOOK (" invhook" , referencable = false ),
58
- CONSTANT (" constant" , referencable = false );
59
+ CONSTANT (" constant" , referencable = false ),
60
+ CLIENTSCRIPT (" clientscript" , referencable = false );
59
61
60
62
override val representation: String
61
63
get() = literal
62
64
63
65
val baseType: RsBaseType
64
- get() = when (this ) {
66
+ get() = when (this ) {
65
67
STRING -> RsBaseType .STRING
66
68
LONG -> RsBaseType .LONG
67
69
else -> RsBaseType .INT
68
70
}
69
71
72
+ val isDeclarable: Boolean
73
+ get() = referencable
74
+
70
75
companion object {
71
- private val LOOKUP_REFERENCABLE_BY_LITERAL = RsPrimitiveType .values().associateBy { it.literal }.filterValues { it.referencable }
72
- private val LOOKUP_BY_LITERAL = RsPrimitiveType .values().associateBy { it.literal }
76
+
77
+ private val LOOKUP_REFERENCABLE_BY_LITERAL = RsPrimitiveType .values()
78
+ .associateBy { it.literal }
79
+ .filterValues { it.referencable }
80
+
81
+ private val LOOKUP_BY_LITERAL = RsPrimitiveType .values()
82
+ .associateBy { it.literal }
73
83
74
84
fun lookupReferencableOrNull (literal : String ) = LOOKUP_REFERENCABLE_BY_LITERAL [literal]
75
- fun lookupReferencable (literal : String ) = lookupReferencableOrNull(literal) ? : error(" No primitive type could be found for literal: `$literal `" )
85
+
86
+ fun lookupReferencable (literal : String ) = lookupReferencableOrNull(literal)
87
+ ? : error(" No primitive type could be found for literal: `$literal `" )
88
+
76
89
fun lookupOrNull (literal : String ) = LOOKUP_BY_LITERAL [literal]
77
- fun lookup (literal : String ) = lookupOrNull(literal) ? : error(" No primitive type could be found for literal: `$literal `" )
90
+
91
+ fun lookup (literal : String ) = lookupOrNull(literal)
92
+ ? : error(" No primitive type could be found for literal: `$literal `" )
78
93
}
79
94
}
0 commit comments