Make enum/constant binds 64-bit.
This commit is contained in:
parent
78944fef82
commit
860e24683f
16 changed files with 48 additions and 46 deletions
|
|
@ -62,7 +62,7 @@ GDScriptNativeClass::GDScriptNativeClass(const StringName &p_name) {
|
|||
|
||||
bool GDScriptNativeClass::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
bool ok;
|
||||
int v = ClassDB::get_integer_constant(name, p_name, &ok);
|
||||
int64_t v = ClassDB::get_integer_constant(name, p_name, &ok);
|
||||
|
||||
if (ok) {
|
||||
r_ret = v;
|
||||
|
|
|
|||
|
|
@ -2900,7 +2900,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
|
|||
return;
|
||||
}
|
||||
bool valid = false;
|
||||
int int_constant = ClassDB::get_integer_constant(native, name, &valid);
|
||||
int64_t int_constant = ClassDB::get_integer_constant(native, name, &valid);
|
||||
if (valid) {
|
||||
p_identifier->is_constant = true;
|
||||
p_identifier->reduced_value = int_constant;
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||
// Class C++ integer constant.
|
||||
if (nc) {
|
||||
bool success = false;
|
||||
int constant = ClassDB::get_integer_constant(nc->get_name(), identifier, &success);
|
||||
int64_t constant = ClassDB::get_integer_constant(nc->get_name(), identifier, &success);
|
||||
if (success) {
|
||||
return codegen.add_constant(constant);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||
|
||||
List<StringName> snames;
|
||||
|
||||
for (const KeyValue<StringName, int> &F : t->constant_map) {
|
||||
for (const KeyValue<StringName, int64_t> &F : t->constant_map) {
|
||||
snames.push_back(F.key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
|
|||
}
|
||||
}
|
||||
|
||||
p_output.append(MEMBER_BEGIN "public const int ");
|
||||
p_output.append(MEMBER_BEGIN "public const long ");
|
||||
p_output.append(iconstant.proxy_name);
|
||||
p_output.append(" = ");
|
||||
p_output.append(itos(iconstant.value));
|
||||
|
|
@ -992,6 +992,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
|
|||
|
||||
p_output.append("\n" INDENT1 "public enum ");
|
||||
p_output.append(enum_proxy_name);
|
||||
p_output.append(" : long");
|
||||
p_output.append("\n" INDENT1 OPEN_BLOCK);
|
||||
|
||||
const ConstantInterface &last = ienum.constants.back()->get();
|
||||
|
|
@ -1417,7 +1418,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
|
|||
}
|
||||
}
|
||||
|
||||
output.append(MEMBER_BEGIN "public const int ");
|
||||
output.append(MEMBER_BEGIN "public const long ");
|
||||
output.append(iconstant.proxy_name);
|
||||
output.append(" = ");
|
||||
output.append(itos(iconstant.value));
|
||||
|
|
@ -1435,6 +1436,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
|
|||
|
||||
output.append(MEMBER_BEGIN "public enum ");
|
||||
output.append(ienum.cname.operator String());
|
||||
output.append(" : long");
|
||||
output.append(MEMBER_BEGIN OPEN_BLOCK);
|
||||
|
||||
const ConstantInterface &last = ienum.constants.back()->get();
|
||||
|
|
@ -3088,7 +3090,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
const List<StringName> &enum_constants = E.value;
|
||||
for (const StringName &constant_cname : enum_constants) {
|
||||
String constant_name = constant_cname.operator String();
|
||||
int *value = class_info->constant_map.getptr(constant_cname);
|
||||
int64_t *value = class_info->constant_map.getptr(constant_cname);
|
||||
ERR_FAIL_NULL_V(value, false);
|
||||
constants.erase(constant_name);
|
||||
|
||||
|
|
@ -3123,7 +3125,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
}
|
||||
|
||||
for (const String &constant_name : constants) {
|
||||
int *value = class_info->constant_map.getptr(StringName(constant_name));
|
||||
int64_t *value = class_info->constant_map.getptr(StringName(constant_name));
|
||||
ERR_FAIL_NULL_V(value, false);
|
||||
|
||||
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value);
|
||||
|
|
@ -3666,7 +3668,7 @@ void BindingsGenerator::_populate_global_constants() {
|
|||
}
|
||||
}
|
||||
|
||||
int constant_value = CoreConstants::get_global_constant_value(i);
|
||||
int64_t constant_value = CoreConstants::get_global_constant_value(i);
|
||||
StringName enum_name = CoreConstants::get_global_constant_enum(i);
|
||||
|
||||
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), constant_value);
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ class BindingsGenerator {
|
|||
struct ConstantInterface {
|
||||
String name;
|
||||
String proxy_name;
|
||||
int value = 0;
|
||||
int64_t value = 0;
|
||||
const DocData::ConstantDoc *const_doc;
|
||||
|
||||
ConstantInterface() {}
|
||||
|
||||
ConstantInterface(const String &p_name, const String &p_proxy_name, int p_value) {
|
||||
ConstantInterface(const String &p_name, const String &p_proxy_name, int64_t p_value) {
|
||||
name = p_name;
|
||||
proxy_name = p_proxy_name;
|
||||
value = p_value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue