aboutsummaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gd_script.cpp')
-rw-r--r--modules/gdscript/gd_script.cpp86
1 files changed, 51 insertions, 35 deletions
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 9a3f50d3b..1b2ed670a 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -1874,19 +1874,27 @@ Error GDScript::reload() {
if (ScriptDebugger::get_singleton()) {
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),parser.get_error_line(),"Parser Error: "+parser.get_error());
}
- _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data());
+ _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
ERR_FAIL_V(ERR_PARSE_ERROR);
}
+
+ bool can_run = ScriptServer::is_scripting_enabled() || parser.is_tool_script();
+
GDCompiler compiler;
err = compiler.compile(&parser,this);
if (err) {
- if (ScriptDebugger::get_singleton()) {
- GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),compiler.get_error_line(),"Parser Error: "+compiler.get_error());
+
+ if (can_run) {
+ if (ScriptDebugger::get_singleton()) {
+ GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),compiler.get_error_line(),"Parser Error: "+compiler.get_error());
+ }
+ _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
+ ERR_FAIL_V(ERR_COMPILATION_FAILED);
+ } else {
+ return err;
}
- _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data());
- ERR_FAIL_V(ERR_COMPILATION_FAILED);
}
valid=true;
@@ -2053,7 +2061,7 @@ Error GDScript::load_byte_code(const String& p_path) {
GDParser parser;
Error err = parser.parse_bytecode(bytecode,basedir,get_path());
if (err) {
- _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data());
+ _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
ERR_FAIL_V(ERR_PARSE_ERROR);
}
@@ -2061,7 +2069,7 @@ Error GDScript::load_byte_code(const String& p_path) {
err = compiler.compile(&parser,this);
if (err) {
- _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data());
+ _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
ERR_FAIL_V(ERR_COMPILATION_FAILED);
}
@@ -2448,6 +2456,7 @@ void GDInstance::get_method_list(List<MethodInfo> *p_list) const {
MethodInfo mi;
mi.name=E->key();
+ mi.flags|=METHOD_FLAG_FROM_SCRIPT;
for(int i=0;i<E->get().get_argument_count();i++)
mi.arguments.push_back(PropertyInfo(Variant::NIL,"arg"+itos(i)));
p_list->push_back(mi);
@@ -2669,40 +2678,47 @@ void GDScriptLanguage::frame() {
void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
static const char *_reserved_words[]={
- "break",
- "class",
- "continue",
- "const",
- "else",
- "elif",
- "enum",
- "extends" ,
- "onready",
- "for" ,
- "func" ,
- "if" ,
- "in" ,
- "null" ,
- "not" ,
- "return" ,
- "self" ,
- "while" ,
- "true" ,
- "false" ,
- "tool",
- "var",
- "setget",
- "pass",
+ // operators
"and",
+ "in",
+ "not",
"or",
- "export",
+ // types and values
+ "false",
+ "float",
+ "int",
+ "null",
+ "PI",
+ "self",
+ "true",
+ // functions
"assert",
"breakpoint",
+ "class",
+ "extends",
+ "func",
+ "preload",
+ "setget",
+ "signal",
+ "tool",
"yield",
+ // var
+ "const",
+ "enum",
+ "export",
+ "onready",
"static",
- "float",
- "int",
- "signal",
+ "var",
+ // control flow
+ "break",
+ "continue",
+ "if",
+ "elif",
+ "else",
+ "for",
+ "pass",
+ "return",
+ "while",
0};