GDScript supports const declarations inside method bodies (local constants), but the parser doesn't recognize const as a statement-level keyword. This causes const NAME := value to be split into multiple expression statements instead of a single GDVariableDeclarationStatement.
func join() -> String:
const SEP := " | "
return "a" + SEP + "b"
Iterating method.AllNodes, the const SEP := " | " line produces three separate nodes instead of one GDVariableDeclarationStatement:
GDExpressionStatement: const
GDExpressionStatement: SEP
GDExpressionStatement: " | "
GDScript supports const declarations inside method bodies (local constants), but the parser doesn't recognize const as a statement-level keyword. This causes
const NAME := valueto be split into multiple expression statements instead of a single GDVariableDeclarationStatement.Iterating method.AllNodes, the const SEP := " | " line produces three separate nodes instead of one GDVariableDeclarationStatement: