Initialize class/struct variables with default values in modules/
This commit is contained in:
parent
57e2822a05
commit
f7209b459b
100 changed files with 533 additions and 772 deletions
|
|
@ -39,8 +39,8 @@
|
|||
class GDScriptEditorTranslationParserPlugin : public EditorTranslationParserPlugin {
|
||||
GDCLASS(GDScriptEditorTranslationParserPlugin, EditorTranslationParserPlugin);
|
||||
|
||||
Vector<String> *ids;
|
||||
Vector<Vector<String>> *ids_ctx_plural;
|
||||
Vector<String> *ids = nullptr;
|
||||
Vector<Vector<String>> *ids_ctx_plural = nullptr;
|
||||
|
||||
// List of patterns used for extracting translation strings.
|
||||
StringName tr_func = "tr";
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ StringName GDScript::get_instance_base_type() const {
|
|||
}
|
||||
|
||||
struct _GDScriptMemberSort {
|
||||
int index;
|
||||
int index = 0;
|
||||
StringName name;
|
||||
_FORCE_INLINE_ bool operator<(const _GDScriptMemberSort &p_member) const { return index < p_member.index; }
|
||||
};
|
||||
|
|
@ -1162,17 +1162,6 @@ String GDScript::_get_gdscript_reference_class_name(const GDScript *p_gdscript)
|
|||
|
||||
GDScript::GDScript() :
|
||||
script_list(this) {
|
||||
valid = false;
|
||||
subclass_count = 0;
|
||||
initializer = nullptr;
|
||||
_base = nullptr;
|
||||
_owner = nullptr;
|
||||
tool = false;
|
||||
#ifdef TOOLS_ENABLED
|
||||
source_changed_cache = false;
|
||||
placeholder_fallback_enabled = false;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
{
|
||||
MutexLock lock(GDScriptLanguage::get_singleton()->lock);
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ public:
|
|||
|
||||
class GDScript : public Script {
|
||||
GDCLASS(GDScript, Script);
|
||||
bool tool;
|
||||
bool valid;
|
||||
bool tool = false;
|
||||
bool valid = false;
|
||||
|
||||
struct MemberInfo {
|
||||
int index;
|
||||
int index = 0;
|
||||
StringName setter;
|
||||
StringName getter;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
|
|
@ -77,8 +77,8 @@ class GDScript : public Script {
|
|||
|
||||
Ref<GDScriptNativeClass> native;
|
||||
Ref<GDScript> base;
|
||||
GDScript *_base; //fast pointer access
|
||||
GDScript *_owner; //for subclasses
|
||||
GDScript *_base = nullptr; //fast pointer access
|
||||
GDScript *_owner = nullptr; //for subclasses
|
||||
|
||||
Set<StringName> members; //members are just indices to the instanced script.
|
||||
Map<StringName, Variant> constants;
|
||||
|
|
@ -97,8 +97,8 @@ class GDScript : public Script {
|
|||
Map<StringName, Variant> member_default_values_cache;
|
||||
Ref<GDScript> base_cache;
|
||||
Set<ObjectID> inheriters_cache;
|
||||
bool source_changed_cache;
|
||||
bool placeholder_fallback_enabled;
|
||||
bool source_changed_cache = false;
|
||||
bool placeholder_fallback_enabled = false;
|
||||
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
|
||||
|
||||
DocData::ClassDoc doc;
|
||||
|
|
@ -121,7 +121,7 @@ class GDScript : public Script {
|
|||
GDScriptFunction *implicit_initializer = nullptr;
|
||||
GDScriptFunction *initializer = nullptr; //direct pointer to new , faster to locate
|
||||
|
||||
int subclass_count;
|
||||
int subclass_count = 0;
|
||||
Set<Object *> instances;
|
||||
//exported members
|
||||
String source;
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ class GDScriptCompiler {
|
|||
Error _parse_class_level(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
||||
Error _parse_class_blocks(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
||||
void _make_scripts(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
|
||||
int err_line;
|
||||
int err_column;
|
||||
int err_line = 0;
|
||||
int err_column = 0;
|
||||
StringName source;
|
||||
String error;
|
||||
bool within_await = false;
|
||||
|
|
|
|||
|
|
@ -77,14 +77,14 @@ int GDScriptFunction::get_max_stack_size() const {
|
|||
}
|
||||
|
||||
struct _GDFKC {
|
||||
int order;
|
||||
int order = 0;
|
||||
List<int> pos;
|
||||
};
|
||||
|
||||
struct _GDFKCS {
|
||||
int order;
|
||||
int order = 0;
|
||||
StringName id;
|
||||
int pos;
|
||||
int pos = 0;
|
||||
|
||||
bool operator<(const _GDFKCS &p_r) const {
|
||||
return order < p_r.order;
|
||||
|
|
@ -294,7 +294,6 @@ void GDScriptFunctionState::_bind_methods() {
|
|||
GDScriptFunctionState::GDScriptFunctionState() :
|
||||
scripts_list(this),
|
||||
instances_list(this) {
|
||||
function = nullptr;
|
||||
}
|
||||
|
||||
GDScriptFunctionState::~GDScriptFunctionState() {
|
||||
|
|
|
|||
|
|
@ -420,19 +420,19 @@ private:
|
|||
|
||||
public:
|
||||
struct CallState {
|
||||
GDScript *script;
|
||||
GDScriptInstance *instance;
|
||||
GDScript *script = nullptr;
|
||||
GDScriptInstance *instance = nullptr;
|
||||
#ifdef DEBUG_ENABLED
|
||||
StringName function_name;
|
||||
String script_path;
|
||||
#endif
|
||||
Vector<uint8_t> stack;
|
||||
int stack_size;
|
||||
int stack_size = 0;
|
||||
Variant self;
|
||||
uint32_t alloca_size;
|
||||
int ip;
|
||||
int line;
|
||||
int defarg;
|
||||
uint32_t alloca_size = 0;
|
||||
int ip = 0;
|
||||
int line = 0;
|
||||
int defarg = 0;
|
||||
Variant result;
|
||||
};
|
||||
|
||||
|
|
@ -488,7 +488,7 @@ public:
|
|||
class GDScriptFunctionState : public Reference {
|
||||
GDCLASS(GDScriptFunctionState, Reference);
|
||||
friend class GDScriptFunction;
|
||||
GDScriptFunction *function;
|
||||
GDScriptFunction *function = nullptr;
|
||||
GDScriptFunction::CallState state;
|
||||
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||
Ref<GDScriptFunctionState> first_state;
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ public:
|
|||
OP_COMP_GREATER_EQUAL,
|
||||
};
|
||||
|
||||
OpType operation;
|
||||
OpType operation = OpType::OP_ADDITION;
|
||||
Variant::Operator variant_op = Variant::OP_MAX;
|
||||
ExpressionNode *left_operand = nullptr;
|
||||
ExpressionNode *right_operand = nullptr;
|
||||
|
|
@ -753,7 +753,7 @@ public:
|
|||
|
||||
struct MatchBranchNode : public Node {
|
||||
Vector<PatternNode *> patterns;
|
||||
SuiteNode *block;
|
||||
SuiteNode *block = nullptr;
|
||||
bool has_wildcard = false;
|
||||
|
||||
MatchBranchNode() {
|
||||
|
|
@ -1001,7 +1001,7 @@ public:
|
|||
OP_LOGIC_NOT,
|
||||
};
|
||||
|
||||
OpType operation;
|
||||
OpType operation = OP_POSITIVE;
|
||||
Variant::Operator variant_op = Variant::OP_MAX;
|
||||
ExpressionNode *operand = nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,6 @@ public:
|
|||
}
|
||||
|
||||
Token() {
|
||||
type = EMPTY;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@
|
|||
#include "editor/editor_node.h"
|
||||
|
||||
GDScriptLanguageServer::GDScriptLanguageServer() {
|
||||
thread_running = false;
|
||||
started = false;
|
||||
|
||||
use_thread = false;
|
||||
port = 6008;
|
||||
_EDITOR_DEF("network/language_server/remote_port", port);
|
||||
_EDITOR_DEF("network/language_server/enable_smart_resolve", true);
|
||||
_EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false);
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ class GDScriptLanguageServer : public EditorPlugin {
|
|||
GDScriptLanguageProtocol protocol;
|
||||
|
||||
Thread thread;
|
||||
bool thread_running;
|
||||
bool started;
|
||||
bool use_thread;
|
||||
int port;
|
||||
bool thread_running = false;
|
||||
bool started = false;
|
||||
bool use_thread = false;
|
||||
int port = 6008;
|
||||
static void thread_main(void *p_userdata);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -547,7 +547,7 @@ struct TextDocumentItem {
|
|||
* The version number of this document (it will increase after each
|
||||
* change, including undo/redo).
|
||||
*/
|
||||
int version;
|
||||
int version = 0;
|
||||
|
||||
/**
|
||||
* The content of the opened text document.
|
||||
|
|
@ -584,7 +584,7 @@ struct TextDocumentContentChangeEvent {
|
|||
/**
|
||||
* The length of the range that got replaced.
|
||||
*/
|
||||
int rangeLength;
|
||||
int rangeLength = 0;
|
||||
|
||||
/**
|
||||
* The new text of the range/document.
|
||||
|
|
@ -656,12 +656,12 @@ struct Diagnostic {
|
|||
* The diagnostic's severity. Can be omitted. If omitted it is up to the
|
||||
* client to interpret diagnostics as error, warning, info or hint.
|
||||
*/
|
||||
int severity;
|
||||
int severity = 0;
|
||||
|
||||
/**
|
||||
* The diagnostic's code, which might appear in the user interface.
|
||||
*/
|
||||
int code;
|
||||
int code = 0;
|
||||
|
||||
/**
|
||||
* A human-readable string describing the source of this
|
||||
|
|
@ -833,7 +833,7 @@ struct CompletionItem {
|
|||
* an icon is chosen by the editor. The standardized set
|
||||
* of available values is defined in `CompletionItemKind`.
|
||||
*/
|
||||
int kind;
|
||||
int kind = 0;
|
||||
|
||||
/**
|
||||
* A human-readable string with additional information
|
||||
|
|
@ -891,7 +891,7 @@ struct CompletionItem {
|
|||
* The format of the insert text. The format applies to both the `insertText` property
|
||||
* and the `newText` property of a provided `textEdit`.
|
||||
*/
|
||||
int insertTextFormat;
|
||||
int insertTextFormat = 0;
|
||||
|
||||
/**
|
||||
* An edit which is applied to a document when selecting this completion. When an edit is provided the value of
|
||||
|
|
@ -1003,7 +1003,7 @@ struct CompletionList {
|
|||
* This list it not complete. Further typing should result in recomputing
|
||||
* this list.
|
||||
*/
|
||||
bool isIncomplete;
|
||||
bool isIncomplete = false;
|
||||
|
||||
/**
|
||||
* The completion items.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue