Skip to content

Commit 292c695

Browse files
committed
Changed default TYPE_DECL to UNDEFINED
1 parent bef83f9 commit 292c695

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/noppes/npcs/client/gui/util/script/JavaTextContainer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ private boolean isFieldAccess(int position) {
373373
private boolean isMethodCall(int position) {
374374
// Skip whitespace after identifier
375375
int i = position;
376-
while (i < text.length() && Character.isLetterOrDigit(text.charAt(i)) || text.charAt(i) == '_') {
376+
// Note: parentheses needed to avoid evaluating text.charAt(i) when i >= text.length()
377+
while (i < text.length() && (Character.isLetterOrDigit(text.charAt(i)) || text.charAt(i) == '_')) {
377378
i++;
378379
}
379380
// Skip whitespace
@@ -792,11 +793,12 @@ private void collectTypeDeclarations(List<Mark> marks) {
792793

793794
// Resolve the main type
794795
ClassPathFinder.ClassInfo info = classPathFinder.resolveSimpleName(typeName, importedClasses);
795-
TokenType tokenType = TokenType.TYPE_DECL;
796+
TokenType tokenType = TokenType.UNDEFINED_VAR;
796797
if (info != null) {
797798
switch (info.type) {
798799
case INTERFACE: tokenType = TokenType.INTERFACE_DECL; break;
799800
case ENUM: tokenType = TokenType.ENUM_DECL; break;
801+
default: tokenType = TokenType.TYPE_DECL;
800802
}
801803
}
802804
marks.add(new Mark(typeNameStart, typeNameEnd, tokenType));

0 commit comments

Comments
 (0)