diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ea91e477..4d677309 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,7 +5,7 @@ on: [push]
# Global Cache Settings
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- GODOT_BASE_BRANCH: '3.2.3-stable'
+ GODOT_BASE_BRANCH: '3.3-stable'
BASE_BRANCH: master
SCONS_CACHE_LIMIT: 4096
diff --git a/README.md b/README.md
index 677a0f89..fdd9854a 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ You can also get the binaries with lastest commits from the [github build action
### Compilation
* Clone the source code of [godot](https://github.com/godotengine/godot)
* Clone this module and put it into `godot/modules/` and make sure the folder name of this module is `ECMAScript`
-* [Recompile the godot engine](https://docs.godotengine.org/en/3.2/development/compiling/index.html) (Only MinGW is supported on Windows for now!)
+* [Recompile the godot engine](https://docs.godotengine.org/en/3.3/development/compiling/index.html) (Only MinGW is supported on Windows for now!)

diff --git a/SCsub b/SCsub
index 5e8024b0..f5c932ba 100644
--- a/SCsub
+++ b/SCsub
@@ -19,7 +19,7 @@ def dump_text_file_to_cpp(file):
length = len(lines)
for i in range(length):
line = lines[i].replace('"', '\\"')
- line = '\t"' + line + '\\n"';
+ line = '\t"' + line + '\\n"'
if i < length -1:
line += "\n"
source += line
@@ -57,7 +57,7 @@ sources = [
if env['tools']:
with open_file("tools/godot.d.ts.gen.cpp", "w") as f:
- text = '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "editor_tools.h"\nString ECMAScriptPlugin::BUILTIN_DECLEARATION_TEXT = \n${source};';
+ text = '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "editor_tools.h"\nString ECMAScriptPlugin::BUILTIN_DECLARATION_TEXT = \n${source};'
f.write(text.replace('${source}', dump_text_file_to_cpp("misc/godot.d.ts")))
with open_file("tools/tsconfig.json.gen.cpp", "w") as f:
text = '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "editor_tools.h"\nString ECMAScriptPlugin::TSCONFIG_CONTENT = \n${source};'
@@ -71,5 +71,4 @@ if env['tools']:
env_module.add_source_files(env.modules_sources, 'tools/*.cpp')
env_module.Append(CPPPATH=["#modules/ECMAScript"])
-env_module.Append(CXXFLAGS=["-std=c++11"])
env_module.add_source_files(env.modules_sources, sources)
diff --git a/generate_builtin_api.py b/generate_builtin_api.py
index 45f72408..ec707e83 100755
--- a/generate_builtin_api.py
+++ b/generate_builtin_api.py
@@ -331,7 +331,7 @@
]
}
-def apply_parttern(template, values):
+def apply_pattern(template, values):
for key in values:
template = template.replace( '${' + key + '}', values[key])
return template
@@ -405,7 +405,7 @@ def parse_class(cls):
if class_name in IGNORED_PROPS and const_name in IGNORED_PROPS[class_name]:
continue
constants.append(dict(c.attrib))
- return json.loads(apply_parttern(json.dumps(ret), {
+ return json.loads(apply_pattern(json.dumps(ret), {
'class_name': class_name,
}))
@@ -413,7 +413,7 @@ def generate_api_json(MODULE_DIR):
DOCS_DIR = os.path.abspath(os.path.join(MODULE_DIR, "../../doc/classes"))
if not os.path.isdir(DOCS_DIR) and len(sys.argv) > 1:
DOCS_DIR = sys.argv[-1]
- OUTPUT_FILE = os.path.join(MODULE_DIR, "buitin_api.gen.json");
+ OUTPUT_FILE = os.path.join(MODULE_DIR, "builtin_api.gen.json")
classes = []
for cls in BUILTIN_CLASSES:
diff --git a/quickjs/builtin_binding_generator.py b/quickjs/builtin_binding_generator.py
index 13726841..5c1c339f 100644
--- a/quickjs/builtin_binding_generator.py
+++ b/quickjs/builtin_binding_generator.py
@@ -3,7 +3,7 @@
DIR = os.path.abspath( os.path.dirname(__file__) )
OUTPUT_FILE = os.path.join(DIR, "quickjs_builtin_binder.gen.cpp")
-API = json.load(open(os.path.join(DIR, '..', 'buitin_api.gen.json'), 'r'))
+API = json.load(open(os.path.join(DIR, '..', 'builtin_api.gen.json'), 'r'))
VariantTypes = {
"boolean": "Variant::BOOL",
@@ -104,7 +104,7 @@
"Variant": 'QuickJSBinder::variant_to_var(ctx, ${arg})',
}
-def apply_parttern(template, values):
+def apply_pattern(template, values):
for key in values:
template = template.replace( '${' + key + '}', values[key])
return template
@@ -411,22 +411,22 @@ def generate_constructor(cls):
}
}
''',
- "PoolByteArray": apply_parttern(TemplatePoolArrays, {"class": "PoolByteArray", "type": "Variant::POOL_BYTE_ARRAY", "element": "uint8_t"}),
- "PoolIntArray": apply_parttern(TemplatePoolArrays, {"class": "PoolIntArray", "type": "Variant::POOL_INT_ARRAY", "element": "int"}),
- "PoolRealArray": apply_parttern(TemplatePoolArrays, {"class": "PoolRealArray", "type": "Variant::POOL_REAL_ARRAY", "element": "real_t"}),
- "PoolVector2Array": apply_parttern(TemplatePoolArrays, {"class": "PoolVector2Array", "type": "Variant::POOL_VECTOR2_ARRAY", "element": "Vector2"}),
- "PoolVector3Array": apply_parttern(TemplatePoolArrays, {"class": "PoolVector3Array", "type": "Variant::POOL_VECTOR3_ARRAY", "element": "Vector3"}),
- "PoolColorArray": apply_parttern(TemplatePoolArrays, {"class": "PoolColorArray", "type": "Variant::POOL_COLOR_ARRAY", "element": "Color"}),
- "PoolStringArray": apply_parttern(TemplateSimplePoolArrays,{"class": "PoolStringArray", "type": "Variant::POOL_STRING_ARRAY", "element": "String"}),
+ "PoolByteArray": apply_pattern(TemplatePoolArrays, {"class": "PoolByteArray", "type": "Variant::POOL_BYTE_ARRAY", "element": "uint8_t"}),
+ "PoolIntArray": apply_pattern(TemplatePoolArrays, {"class": "PoolIntArray", "type": "Variant::POOL_INT_ARRAY", "element": "int"}),
+ "PoolRealArray": apply_pattern(TemplatePoolArrays, {"class": "PoolRealArray", "type": "Variant::POOL_REAL_ARRAY", "element": "real_t"}),
+ "PoolVector2Array": apply_pattern(TemplatePoolArrays, {"class": "PoolVector2Array", "type": "Variant::POOL_VECTOR2_ARRAY", "element": "Vector2"}),
+ "PoolVector3Array": apply_pattern(TemplatePoolArrays, {"class": "PoolVector3Array", "type": "Variant::POOL_VECTOR3_ARRAY", "element": "Vector3"}),
+ "PoolColorArray": apply_pattern(TemplatePoolArrays, {"class": "PoolColorArray", "type": "Variant::POOL_COLOR_ARRAY", "element": "Color"}),
+ "PoolStringArray": apply_pattern(TemplateSimplePoolArrays,{"class": "PoolStringArray", "type": "Variant::POOL_STRING_ARRAY", "element": "String"}),
}
class_name = cls['name']
- constructor_name = apply_parttern(TemplateConstructorName, {"class": class_name})
- constructor_declare = apply_parttern(TemplateConstructorDeclare, {"class": class_name})
+ constructor_name = apply_pattern(TemplateConstructorName, {"class": class_name})
+ constructor_declare = apply_pattern(TemplateConstructorDeclare, {"class": class_name})
initializer = ''
if class_name in ConstructorInitializers:
initializer = ConstructorInitializers[class_name]
- consturctor = apply_parttern(TemplateConstructor, {
+ consturctor = apply_pattern(TemplateConstructor, {
'class': class_name,
'type': VariantTypes[class_name],
'func': constructor_name,
@@ -479,21 +479,21 @@ def generate_members(cls):
type = p['type']
name = p['name']
native_name = p['native']
- getters += apply_parttern(TemplateGetterItem, {
+ getters += apply_pattern(TemplateGetterItem, {
'index': str(i),
- 'value': apply_parttern(GodotToJSTemplates[type], { 'arg': apply_parttern('ptr->${native}', {'native': native_name}) })
+ 'value': apply_pattern(GodotToJSTemplates[type], { 'arg': apply_pattern('ptr->${native}', {'native': native_name}) })
})
- setters += apply_parttern(TemplateSetterItem, {
+ setters += apply_pattern(TemplateSetterItem, {
'index': str(i),
'name': name,
'native': native_name,
'type': VariantTypes[type],
'type_name': type,
'class': class_name,
- 'value': apply_parttern(JSToGodotTemplates[type], {'arg': 'argv[0]'})
+ 'value': apply_pattern(JSToGodotTemplates[type], {'arg': 'argv[0]'})
})
- bindings += apply_parttern(TemplateItemBinding, {'index': str(i), 'name': name, 'type': VariantTypes[class_name]})
- return apply_parttern(Template, {
+ bindings += apply_pattern(TemplateItemBinding, {'index': str(i), 'name': name, 'type': VariantTypes[class_name]})
+ return apply_pattern(Template, {
'class': class_name,
'getters': getters,
'setters': setters,
@@ -509,12 +509,12 @@ def generate_methods(cls):
[](JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) {
ECMAScriptGCHandler *bind = BINDING_DATA_FROM_JS(ctx, this_val);
${class} *ptr = bind->get${class}();\
-${arg_declars}
+${arg_declares}
${call}
return ${return};
},
${argc});'''
- TemplateArgDeclear = '''
+ TemplateArgDeclare = '''
#ifdef DEBUG_METHODS_ENABLED
ERR_FAIL_COND_V(!QuickJSBinder::validate_type(ctx, ${type}, argv[${index}]), (JS_ThrowTypeError(ctx, "${type_name} expected for argument ${index} of ${class}.${name}")));
#endif
@@ -524,31 +524,31 @@ def generate_methods(cls):
bindings = ''
for m in cls['methods']:
args = ''
- arg_declars = ''
+ arg_declares = ''
for i in range(len(m['arguments'])):
arg = m['arguments'][i]
arg_type = arg['type']
- arg_declars += apply_parttern(TemplateArgDeclear, {
+ arg_declares += apply_pattern(TemplateArgDeclare, {
'index': str(i),
'type': VariantTypes[arg_type],
'type_name': arg_type,
'class': class_name,
'name': m['name'],
- 'arg': apply_parttern(JSToGodotTemplates[arg_type], {'arg': 'argv[' + str(i) +']'}),
+ 'arg': apply_pattern(JSToGodotTemplates[arg_type], {'arg': 'argv[' + str(i) +']'}),
'godot_type': GodotTypeNames[arg_type],
})
if i > 0: args += ', '
args += 'arg' + str(i)
- CallTemplate = ('' if m['return'] == 'void' else (apply_parttern(TemplateReturnValue, {"godot_type": GodotTypeNames[m['return']]}))) + 'ptr->${native_method}(${args});'
- call = apply_parttern(CallTemplate, {'native_method': m['native_method'], 'args': args})
- bindings += apply_parttern(TemplateMethod, {
+ CallTemplate = ('' if m['return'] == 'void' else (apply_pattern(TemplateReturnValue, {"godot_type": GodotTypeNames[m['return']]}))) + 'ptr->${native_method}(${args});'
+ call = apply_pattern(CallTemplate, {'native_method': m['native_method'], 'args': args})
+ bindings += apply_pattern(TemplateMethod, {
"class": class_name,
"type": VariantTypes[class_name],
"name": m['name'],
"call": call,
- "arg_declars": arg_declars,
+ "arg_declares": arg_declares,
"argc": str(len(m['arguments'])),
- "return": 'JS_UNDEFINED' if m['return'] == 'void' else apply_parttern(GodotToJSTemplates[m['return']], {'arg': 'ret'}),
+ "return": 'JS_UNDEFINED' if m['return'] == 'void' else apply_pattern(GodotToJSTemplates[m['return']], {'arg': 'ret'}),
})
return bindings
@@ -556,7 +556,7 @@ def generate_constants(cls):
ConstTemplate = '\tbinder->get_builtin_binder().register_constant(${type}, "${name}", ${value});\n'
bindings = ''
for c in cls['constants']:
- bindings += apply_parttern(ConstTemplate, {
+ bindings += apply_pattern(ConstTemplate, {
"name": c['name'],
"type": VariantTypes[class_name],
"value": c['value']
@@ -572,7 +572,7 @@ def genertate_operators(cls):
'operator==': '==',
'operator<': '<'
}
- TargetDeclearTemplate = '''
+ TargetDeclareTemplate = '''
#ifdef DEBUG_METHODS_ENABLED
ERR_FAIL_COND_V(!QuickJSBinder::validate_type(ctx, ${type}, argv[1]), (JS_ThrowTypeError(ctx, "${target_class} expected for ${class}.${operator}")));
#endif
@@ -584,7 +584,7 @@ def genertate_operators(cls):
JS_NewCFunction(ctx, [](JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) {
ECMAScriptGCHandler *bind = BINDING_DATA_FROM_JS(ctx, argv[0]);
${class} *ptr = bind->get${class}();\
-${target_declear}
+${target_declare}
${call}
return ${return};
},
@@ -607,29 +607,29 @@ def genertate_operators(cls):
js_op = 'neg'
args = ''
- target_declear = ''
+ target_declare = ''
if argc > 1:
arg_class = o['arguments'][0]['type']
- target_declear = apply_parttern(TargetDeclearTemplate, {
+ target_declare = apply_pattern(TargetDeclareTemplate, {
'target_class': arg_class,
'type': VariantTypes[arg_class],
'class': class_name,
'operator': o['native_method'],
})
args = '*target'
- CallTemplate = ('' if o['return'] == 'void' else apply_parttern(TemplateReturnValue, {'godot_type': GodotTypeNames[o['return']] })) + 'ptr->${op}(${args});'
- call = apply_parttern(CallTemplate, {'op': op, 'args': args})
- bindings += apply_parttern(OperatorTemplate, {
+ CallTemplate = ('' if o['return'] == 'void' else apply_pattern(TemplateReturnValue, {'godot_type': GodotTypeNames[o['return']] })) + 'ptr->${op}(${args});'
+ call = apply_pattern(CallTemplate, {'op': op, 'args': args})
+ bindings += apply_pattern(OperatorTemplate, {
'type': VariantTypes[class_name],
'class': class_name,
'js_op': js_op,
'call': call,
'name': o['name'],
- 'target_declear': target_declear,
- "return": 'JS_UNDEFINED' if o['return'] == 'void' else apply_parttern(GodotToJSTemplates[o['return']], {'arg': 'ret'}),
+ 'target_declare': target_declare,
+ "return": 'JS_UNDEFINED' if o['return'] == 'void' else apply_pattern(GodotToJSTemplates[o['return']], {'arg': 'ret'}),
'argc': str(argc)
})
- bindings += apply_parttern('''
+ bindings += apply_pattern('''
operators.push_back(base_operators);
binder->get_builtin_binder().get_cross_type_operators(${type}, operators);
binder->get_builtin_binder().register_operators(${type}, operators);
@@ -646,21 +646,21 @@ def genertate_operators(cls):
}
'''
class_name = cls['name']
- property_declare = apply_parttern(TemplateDeclar, {"class": class_name})
- property_defines = apply_parttern(TemplateBindDefine, {
+ property_declare = apply_pattern(TemplateDeclar, {"class": class_name})
+ property_defines = apply_pattern(TemplateBindDefine, {
"class": class_name,
"members": generate_members(cls) if len(cls['properties']) else '',
"methods": generate_methods(cls),
"constants": generate_constants(cls),
"operators": genertate_operators(cls),
})
- property_bind = apply_parttern(TemplateBind, {"class": class_name})
+ property_bind = apply_pattern(TemplateBind, {"class": class_name})
return property_declare, property_defines, property_bind
def generate_class_bind_action(cls, constructor):
Template = '\tregister_builtin_class(${type}, "${class}", ${constructor}, ${argc});\n'
- return apply_parttern(Template, {
+ return apply_pattern(Template, {
'class': cls['name'],
'constructor': constructor,
'type': VariantTypes[cls['name']],
@@ -703,7 +703,7 @@ def generate_builtin_bindings():
definitions += property_defines
bindings += property_bind
- output = apply_parttern(Template, {
+ output = apply_pattern(Template, {
'declarations': declarations,
'bindings': bindings,
'definitions': definitions,
diff --git a/quickjs/quickjs_binder.cpp b/quickjs/quickjs_binder.cpp
index 8f83a86f..76bbcf42 100644
--- a/quickjs/quickjs_binder.cpp
+++ b/quickjs/quickjs_binder.cpp
@@ -16,8 +16,9 @@
#include "editor/editor_settings.h"
#endif
-uint32_t QuickJSBinder::global_context_id = 0;
-uint64_t QuickJSBinder::global_transfer_id = 0;
+SafeNumeric QuickJSBinder::global_context_id;
+SafeNumeric QuickJSBinder::global_transfer_id;
+
HashMap QuickJSBinder::transfer_deopot;
Map QuickJSBinder::class_remap;
List compiling_modules;
@@ -187,7 +188,7 @@ JSValue QuickJSBinder::object_method(JSContext *ctx, JSValueConst this_val, int
}
ERR_PRINTS(obj->get_class() + "." + mb->get_name() + ENDL + err_message + ENDL + stack_message);
JS_FreeValue(ctx, ret);
- ret = JS_ThrowTypeError(ctx, err_message.utf8().get_data());
+ ret = JS_ThrowTypeError(ctx, "%s", err_message.utf8().get_data());
}
#endif
@@ -804,7 +805,7 @@ JSClassID QuickJSBinder::register_class(const ClassDB::ClassInfo *p_cls) {
if (class_remap.has(p_cls->name)) {
data.class_name = class_remap[p_cls->name];
data.jsclass.class_name = class_remap[p_cls->name];
- if (data.jsclass.class_name == "") {
+ if (strcmp(data.jsclass.class_name, "") == 0) {
return 0;
}
} else {
@@ -1152,7 +1153,7 @@ void QuickJSBinder::add_godot_globals() {
}
}
- // buitin functions
+ // builtin functions
for (int i = 0; i < Expression::FUNC_MAX; ++i) {
Expression::BuiltinFunc func = (Expression::BuiltinFunc)i;
String name = Expression::get_func_name(func);
@@ -1211,7 +1212,7 @@ void QuickJSBinder::add_godot_globals() {
}
QuickJSBinder::QuickJSBinder() {
- context_id = global_context_id++;
+ context_id = QuickJSBinder::global_context_id.increment();
internal_godot_method_id = 0;
internal_godot_indexed_property_id = 0;
godot_allocator.js_malloc = QuickJSBinder::js_binder_malloc;
@@ -2214,7 +2215,7 @@ const ECMAClassInfo *QuickJSBinder::parse_ecma_class_from_module(ModuleCache *p_
if (!JS_IsFunction(ctx, default_entry)) {
String err = "Failed parse ECMAClass from script " + p_path + ENDL "\t" + "Default export entry must be a godot class!";
ERR_PRINTS(err);
- JS_ThrowTypeError(ctx, err.utf8().get_data());
+ JS_ThrowTypeError(ctx, "%s", err.utf8().get_data());
goto fail;
}
ecma_class = register_ecma_class(default_entry, p_path);
@@ -2320,7 +2321,7 @@ JSValue QuickJSBinder::godot_abandon_value(JSContext *ctx, JSValue this_val, int
uint64_t id = 0;
if (valid) {
- id = atomic_increment(&global_transfer_id);
+ id = QuickJSBinder::global_transfer_id.increment();
GLOBAL_LOCK_FUNCTION
transfer_deopot.set(id, gd_value);
}
diff --git a/quickjs/quickjs_binder.h b/quickjs/quickjs_binder.h
index 55c793d6..6835e0ed 100644
--- a/quickjs/quickjs_binder.h
+++ b/quickjs/quickjs_binder.h
@@ -30,8 +30,8 @@ class QuickJSBinder : public ECMAScriptBinder {
QuickJSBuiltinBinder builtin_binder;
protected:
- static uint32_t global_context_id;
- static uint64_t global_transfer_id;
+ static SafeNumeric global_context_id;
+ static SafeNumeric global_transfer_id;
JSRuntime *runtime;
JSContext *ctx;
JSMallocFunctions godot_allocator;
diff --git a/quickjs/quickjs_worker.cpp b/quickjs/quickjs_worker.cpp
index d993ccc3..3bc14a95 100644
--- a/quickjs/quickjs_worker.cpp
+++ b/quickjs/quickjs_worker.cpp
@@ -89,7 +89,6 @@ JSValue QuickJSWorker::global_import_scripts(JSContext *ctx, JSValue this_val, i
QuickJSWorker::QuickJSWorker(const QuickJSBinder *p_host_context) :
QuickJSBinder() {
- thread = NULL;
running = false;
host_context = p_host_context;
}
@@ -156,16 +155,14 @@ void QuickJSWorker::post_message_from_host(const Variant &p_message) {
}
void QuickJSWorker::start(const String &p_path) {
- ERR_FAIL_COND(running || thread != NULL);
+ ERR_FAIL_COND(running || thread.is_started());
entry_script = p_path;
- thread = Thread::create(thread_main, this);
+ thread.start(thread_main, this);
}
void QuickJSWorker::stop() {
- if (thread != NULL) {
+ if (thread.is_started()) {
running = false;
- Thread::wait_to_finish(thread);
- memdelete(thread);
- thread = NULL;
+ thread.wait_to_finish();
}
}
diff --git a/quickjs/quickjs_worker.h b/quickjs/quickjs_worker.h
index 83582603..9d481dfa 100644
--- a/quickjs/quickjs_worker.h
+++ b/quickjs/quickjs_worker.h
@@ -5,7 +5,7 @@
#include "quickjs_binder.h"
class QuickJSWorker : public QuickJSBinder {
- Thread *thread;
+ Thread thread;
bool running = false;
static void thread_main(void *p_self);
String entry_script;
diff --git a/tools/editor_tools.cpp b/tools/editor_tools.cpp
index 1b2229f4..d713232e 100644
--- a/tools/editor_tools.cpp
+++ b/tools/editor_tools.cpp
@@ -49,7 +49,7 @@ void ECMAScriptPlugin::_notification(int p_what) {
void ECMAScriptPlugin::_on_menu_item_pressed(int item) {
switch (item) {
- case MenuItem::ITEM_GEN_DECLAR_FILE:
+ case MenuItem::ITEM_GEN_DECLARE_FILE:
declaration_file_dialog->popup_centered_ratio();
break;
case MenuItem::ITEM_GEN_TYPESCRIPT_PROJECT:
@@ -65,7 +65,7 @@ ECMAScriptPlugin::ECMAScriptPlugin(EditorNode *p_node) {
PopupMenu *menu = memnew(PopupMenu);
add_tool_submenu_item(TTR("ECMAScript"), menu);
- menu->add_item(TTR("Generate TypeScript Declaration File"), ITEM_GEN_DECLAR_FILE);
+ menu->add_item(TTR("Generate TypeScript Declaration File"), ITEM_GEN_DECLARE_FILE);
menu->add_item(TTR("Generate Enumeration Binding Script"), ITEM_GEN_ENUM_BINDING_SCRIPT);
menu->add_item(TTR("Generate TypeScript Project"), ITEM_GEN_TYPESCRIPT_PROJECT);
menu->connect("id_pressed", this, "_on_menu_item_pressed");
@@ -105,8 +105,8 @@ ECMAScriptPlugin::ECMAScriptPlugin(EditorNode *p_node) {
ts_ignore_errors.insert("SpriteBase3D", ts_ignore_error_members);
}
-static String applay_partern(const String &p_partern, const Dictionary &p_values) {
- String ret = p_partern;
+static String apply_pattern(const String &p_pattern, const Dictionary &p_values) {
+ String ret = p_pattern;
for (const Variant *key = p_values.next(); key; key = p_values.next(key)) {
String p = String("${") + String(*key) + "}";
String v = p_values.get(*key, p);
@@ -277,7 +277,7 @@ String _export_method(const DocData::MethodDoc &p_method, bool is_function = fal
method_template = method_template.replace("${TS_IGNORE}", "");
}
}
- return applay_partern(method_template, dict);
+ return apply_pattern(method_template, dict);
}
String _export_class(const DocData::ClassDoc &class_doc) {
@@ -343,7 +343,7 @@ String _export_class(const DocData::ClassDoc &class_doc) {
} else {
const_str = const_str.replace("${TS_IGNORE}", "");
}
- constants += applay_partern(const_str, dict);
+ constants += apply_pattern(const_str, dict);
if (!const_doc.enumeration.empty()) {
if (!enumerations.has(const_doc.enumeration)) {
@@ -372,7 +372,7 @@ String _export_class(const DocData::ClassDoc &class_doc) {
dict["description"] = format_doc_text(enums[i]->description, "\t\t\t ");
dict["name"] = format_property_name(enums[i]->name);
dict["value"] = enums[i]->value;
- enum_str += applay_partern(const_str, dict);
+ enum_str += apply_pattern(const_str, dict);
}
enum_str += "\t\t}\n";
enumerations_str += enum_str;
@@ -400,7 +400,7 @@ String _export_class(const DocData::ClassDoc &class_doc) {
dict["name"] = format_property_name(prop_doc.name);
dict["type"] = get_type_name(prop_doc.type);
dict["static"] = Engine::get_singleton()->has_singleton(class_doc.name) ? "static " : "";
- properties += applay_partern(prop_str, dict);
+ properties += apply_pattern(prop_str, dict);
if (!prop_doc.getter.empty()) {
DocData::MethodDoc md;
@@ -441,7 +441,7 @@ String _export_class(const DocData::ClassDoc &class_doc) {
Dictionary dict;
dict["description"] = format_doc_text(signal.description, "\t\t\t ");
dict["name"] = signal.name;
- signals += applay_partern(signal_str, dict);
+ signals += apply_pattern(signal_str, dict);
}
dict["signals"] = signals;
@@ -467,7 +467,7 @@ String _export_class(const DocData::ClassDoc &class_doc) {
}
dict["extrals"] = extrals;
- return applay_partern(class_template, dict);
+ return apply_pattern(class_template, dict);
}
void ECMAScriptPlugin::_export_typescript_declare_file(const String &p_path) {
@@ -508,7 +508,7 @@ void ECMAScriptPlugin::_export_typescript_declare_file(const String &p_path) {
Dictionary dict;
const String godot_module = "// This file is generated by godot editor\n"
- "${buitins}\n"
+ "${builtins}\n"
"\n"
"declare module " GODOT_OBJECT_NAME " {\n"
"${constants}\n"
@@ -582,7 +582,7 @@ void ECMAScriptPlugin::_export_typescript_declare_file(const String &p_path) {
} else {
dict["type"] = dict["value"];
}
- constants += applay_partern(const_str, dict);
+ constants += apply_pattern(const_str, dict);
if (!const_doc.enumeration.empty()) {
if (!enumerations.has(const_doc.enumeration)) {
@@ -606,7 +606,7 @@ void ECMAScriptPlugin::_export_typescript_declare_file(const String &p_path) {
dict["description"] = format_doc_text(enums[i]->description, "\t\t\t ");
dict["name"] = format_property_name(enums[i]->name);
dict["value"] = enums[i]->value;
- enum_str += applay_partern(const_str, dict);
+ enum_str += apply_pattern(const_str, dict);
}
enum_str += "\t}\n";
enumerations_str += enum_str;
@@ -631,9 +631,9 @@ void ECMAScriptPlugin::_export_typescript_declare_file(const String &p_path) {
dict["constants"] = constants;
dict["enumerations"] = enumerations_str;
dict["functions"] = functions;
- dict["buitins"] = BUILTIN_DECLEARATION_TEXT;
+ dict["builtins"] = BUILTIN_DECLARATION_TEXT;
- String text = applay_partern(godot_module, dict);
+ String text = apply_pattern(godot_module, dict);
FileAccessRef f = FileAccess::open(p_path, FileAccess::WRITE);
if (f.f && f->is_open()) {
f->store_string(text);
@@ -678,7 +678,7 @@ void ECMAScriptPlugin::_export_enumeration_binding_file(const String &p_path) {
Dictionary dict;
dict["name"] = format_enum_name(E->key());
dict["values"] = enum_items_text;
- class_enums += applay_partern("\n\t\t${name}: { value: ${values} }", dict);
+ class_enums += apply_pattern("\n\t\t${name}: { value: ${values} }", dict);
if (E->next()) {
class_enums += ", ";
} else {
@@ -689,11 +689,11 @@ void ECMAScriptPlugin::_export_enumeration_binding_file(const String &p_path) {
Dictionary dict;
dict["class"] = class_name;
dict["enumerations"] = class_enums;
- enumerations += applay_partern(class_template, dict);
+ enumerations += apply_pattern(class_template, dict);
}
Dictionary dict;
dict["enumerations"] = enumerations;
- file_content = applay_partern(file_content, dict);
+ file_content = apply_pattern(file_content, dict);
dump_to_file(p_path, file_content);
}
diff --git a/tools/editor_tools.h b/tools/editor_tools.h
index c2617c63..ade484b8 100644
--- a/tools/editor_tools.h
+++ b/tools/editor_tools.h
@@ -8,7 +8,7 @@ class ECMAScriptPlugin : public EditorPlugin {
GDCLASS(ECMAScriptPlugin, EditorPlugin);
enum MenuItem {
- ITEM_GEN_DECLAR_FILE,
+ ITEM_GEN_DECLARE_FILE,
ITEM_GEN_TYPESCRIPT_PROJECT,
ITEM_GEN_ENUM_BINDING_SCRIPT,
};
@@ -18,7 +18,7 @@ class ECMAScriptPlugin : public EditorPlugin {
const Dictionary *modified_api;
protected:
- static String BUILTIN_DECLEARATION_TEXT;
+ static String BUILTIN_DECLARATION_TEXT;
static String TSCONFIG_CONTENT;
static String TS_DECORATORS_CONTENT;
static String PACKAGE_JSON_CONTENT;