mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
Ability to put constants in constant expressions, closes #5264
This commit is contained in:
parent
36e754457f
commit
cf0fbe493f
1 changed files with 9 additions and 0 deletions
|
|
@ -31,6 +31,7 @@
|
||||||
#include "io/resource_loader.h"
|
#include "io/resource_loader.h"
|
||||||
#include "os/file_access.h"
|
#include "os/file_access.h"
|
||||||
#include "script_language.h"
|
#include "script_language.h"
|
||||||
|
#include "gd_script.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T* GDParser::alloc_node() {
|
T* GDParser::alloc_node() {
|
||||||
|
|
@ -494,6 +495,14 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GDScriptLanguage::get_singleton()->get_global_map().has(identifier)) {
|
||||||
|
//check from constants
|
||||||
|
ConstantNode *constant = alloc_node<ConstantNode>();
|
||||||
|
constant->value = GDScriptLanguage::get_singleton()->get_global_array()[ GDScriptLanguage::get_singleton()->get_global_map()[identifier] ];
|
||||||
|
expr=constant;
|
||||||
|
bfn = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !bfn ) {
|
if ( !bfn ) {
|
||||||
IdentifierNode *id = alloc_node<IdentifierNode>();
|
IdentifierNode *id = alloc_node<IdentifierNode>();
|
||||||
id->name = identifier;
|
id->name = identifier;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue