summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gd_editor.cpp15
-rw-r--r--modules/gdscript/gd_parser.cpp3
-rw-r--r--modules/gdscript/gd_script.cpp5
-rw-r--r--modules/gdscript/gd_script.h2
4 files changed, 15 insertions, 10 deletions
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index b0408917a4..d9b10ff3fa 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -61,7 +61,11 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
"func _ready():\n" +
"%TS%# Called every time the node is added to the scene.\n" +
"%TS%# Initialization here\n" +
- "%TS%pass\n";
+ "%TS%pass\n\n" +
+ "#func _process(delta):\n" +
+ "#%TS%# Called every frame. Delta is time since last frame.\n" +
+ "#%TS%# Update game logic here.\n" +
+ "#%TS%pass\n";
_template = _template.replace("%BASE%", p_base_class_name);
_template = _template.replace("%TS%", _get_indentation());
@@ -127,6 +131,11 @@ bool GDScriptLanguage::has_named_classes() const {
return false;
}
+bool GDScriptLanguage::supports_builtin_mode() const {
+
+ return true;
+}
+
int GDScriptLanguage::find_function(const String &p_function, const String &p_code) const {
GDTokenizerText tokenizer;
@@ -2102,9 +2111,9 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
for (List<String>::Element *E = opts.front(); E; E = E->next()) {
String opt = E->get().strip_edges();
- if (opt.begins_with("\"") && opt.ends_with("\"")) {
+ if (opt.is_quoted()) {
r_forced = true;
- String idopt = opt.substr(1, opt.length() - 2);
+ String idopt = opt.unquote();
if (idopt.replace("/", "_").is_valid_identifier()) {
options.insert(idopt);
} else {
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 36aaa1f807..94385dc0d0 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1906,7 +1906,8 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) {
// all the constants like strings and numbers
default: {
Node *value = _parse_and_reduce_expression(pattern, p_static);
- if (error_set) {
+ if (!value) {
+ _set_error("Expect constant expression or variables in a pattern");
return NULL;
}
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index cf6529d5ae..3f3818ffb9 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -609,11 +609,6 @@ Error GDScript::reload(bool p_keep_state) {
return OK;
}
-String GDScript::get_node_type() const {
-
- return ""; // ?
-}
-
ScriptLanguage *GDScript::get_language() const {
return GDScriptLanguage::get_singleton();
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 5e1a8b19ac..e0d142014a 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -172,7 +172,6 @@ public:
virtual Error reload(bool p_keep_state = false);
- virtual String get_node_type() const;
void set_script_path(const String &p_path) { path = p_path; } //because subclasses need a path too...
Error load_source_code(const String &p_path);
Error load_byte_code(const String &p_path);
@@ -386,6 +385,7 @@ public:
virtual bool 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 = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool supports_builtin_mode() const;
virtual bool can_inherit_from_file() { return true; }
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;