diff options
| author | Hein-Pieter van Braam | 2018-02-27 16:08:10 +0100 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-02-27 17:52:18 +0100 |
| commit | a850ebf352e9601d46ac116b5112e752a4717953 (patch) | |
| tree | 57ab8b7230a4321321161c9a08084709e904ce2c | |
| parent | 4e1d19b20ca405e3574f9fdcb49ec1333e618b2b (diff) | |
| download | godot-a850ebf352e9601d46ac116b5112e752a4717953.tar.gz godot-a850ebf352e9601d46ac116b5112e752a4717953.tar.zst godot-a850ebf352e9601d46ac116b5112e752a4717953.zip | |
| -rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 532b72ce6..861a35b5f 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -458,9 +458,9 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s if (!validating) { //this can be too slow for just validating code - if (for_completion && ScriptCodeCompletionCache::get_singleton() && FileAccess::exists(path)) { + if (for_completion && ScriptCodeCompletionCache::get_singleton()) { res = ScriptCodeCompletionCache::get_singleton()->get_cached_resource(path); - } else if (!for_completion || FileAccess::exists(path)) { + } else { // essential; see issue 15902 res = ResourceLoader::load(path); } if (!res.is_valid()) { @@ -4358,6 +4358,8 @@ Error GDScriptParser::_parse(const String &p_base_path) { base_path = p_base_path; + clear(); + //assume class ClassNode *main_class = alloc_node<ClassNode>(); main_class->initializer = alloc_node<BlockNode>(); @@ -4382,7 +4384,17 @@ Error GDScriptParser::_parse(const String &p_base_path) { Error GDScriptParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const String &p_base_path, const String &p_self_path) { - clear(); + for_completion = false; + validating = false; + completion_type = COMPLETION_NONE; + completion_node = NULL; + completion_class = NULL; + completion_function = NULL; + completion_block = NULL; + completion_found = false; + current_block = NULL; + current_class = NULL; + current_function = NULL; self_path = p_self_path; GDScriptTokenizerBuffer *tb = memnew(GDScriptTokenizerBuffer); @@ -4396,7 +4408,16 @@ Error GDScriptParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const St Error GDScriptParser::parse(const String &p_code, const String &p_base_path, bool p_just_validate, const String &p_self_path, bool p_for_completion) { - clear(); + completion_type = COMPLETION_NONE; + completion_node = NULL; + completion_class = NULL; + completion_function = NULL; + completion_block = NULL; + completion_found = false; + current_block = NULL; + current_class = NULL; + + current_function = NULL; self_path = p_self_path; GDScriptTokenizerText *tt = memnew(GDScriptTokenizerText); |
