diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /modules/gdnative/nativescript/nativescript.cpp | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) |
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
-o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
-o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```
This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.
This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.
Part of #33027.
Diffstat (limited to 'modules/gdnative/nativescript/nativescript.cpp')
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 70a651be1e..fe9496702a 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -817,6 +817,7 @@ bool NativeScriptInstance::set(const StringName &p_name, const Variant &p_value) } return false; } + bool NativeScriptInstance::get(const StringName &p_name, Variant &r_ret) const { NativeScriptDesc *script_data = GET_SCRIPT_DESC(); @@ -1267,22 +1268,29 @@ void NativeScriptLanguage::init() { EditorNode::add_init_callback(&_add_reload_node); #endif } + String NativeScriptLanguage::get_type() const { return "NativeScript"; } + String NativeScriptLanguage::get_extension() const { return "gdns"; } + Error NativeScriptLanguage::execute_file(const String &p_path) { return OK; // Qué? } + void NativeScriptLanguage::finish() { _unload_stuff(); } + void NativeScriptLanguage::get_reserved_words(List<String> *p_words) const { } + void NativeScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const { } + void NativeScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const { } @@ -1291,6 +1299,7 @@ Ref<Script> NativeScriptLanguage::get_template(const String &p_class_name, const s->set_class_name(p_class_name); return Ref<NativeScript>(s); } + bool NativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const { return true; } @@ -1299,20 +1308,26 @@ Script *NativeScriptLanguage::create_script() const { NativeScript *script = memnew(NativeScript); return script; } + bool NativeScriptLanguage::has_named_classes() const { return true; } + bool NativeScriptLanguage::supports_builtin_mode() const { return true; } + int NativeScriptLanguage::find_function(const String &p_function, const String &p_code) const { return -1; } + String NativeScriptLanguage::make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const { return ""; } + void NativeScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_to_line) const { } + void NativeScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) { } @@ -1320,27 +1335,36 @@ void NativeScriptLanguage::add_global_constant(const StringName &p_variable, con String NativeScriptLanguage::debug_get_error() const { return ""; } + int NativeScriptLanguage::debug_get_stack_level_count() const { return -1; } + int NativeScriptLanguage::debug_get_stack_level_line(int p_level) const { return -1; } + String NativeScriptLanguage::debug_get_stack_level_function(int p_level) const { return ""; } + String NativeScriptLanguage::debug_get_stack_level_source(int p_level) const { return ""; } + void NativeScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) { } + void NativeScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) { } + void NativeScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) { } + String NativeScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) { return ""; } + // Debugging stuff end. void NativeScriptLanguage::reload_all_scripts() { @@ -1348,6 +1372,7 @@ void NativeScriptLanguage::reload_all_scripts() { void NativeScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) { } + void NativeScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const { p_extensions->push_back("gdns"); } |