Browse Source

Avoid unnecessary lookup to builtin variables

Toni Helenius 8 months ago
parent
commit
7163b549e3

+ 3 - 1
jme3-glsl-highlighter/src/com/jme3/gde/glsl/highlighter/lexer/GlslKeywordLibrary.java

@@ -491,7 +491,9 @@ final class GlslKeywordLibrary {
     public static KeywordType lookup(String s) {
         KeywordType returnType = null;
         returnType = lookup(s, returnType, KeywordType.BASIC_TYPE, basicTypesTrie);
-        returnType = lookup(s, returnType, KeywordType.BUILTIN_VARIABLE, builtinVariablesTrie);
+        if (returnType == KeywordType.UNFINISHED || returnType == null) {
+            returnType = lookup(s, returnType, KeywordType.BUILTIN_VARIABLE, builtinVariablesTrie);
+        }
         if (returnType == KeywordType.UNFINISHED || returnType == null) {
             returnType = lookup(s, returnType, KeywordType.BUILTIN_FUNCTION, builtinFunctionsTrie);
         }