summaryrefslogtreecommitdiff
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.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 0b81780b0c..4e72bc39a4 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "gd_script.h"
-#include "globals.h"
+#include "global_config.h"
#include "global_constants.h"
#include "gd_compiler.h"
#include "os/file_access.h"
@@ -63,7 +63,7 @@ bool GDNativeClass::_get(const StringName& p_name,Variant &r_ret) const {
void GDNativeClass::_bind_methods() {
- ClassDB::bind_method(_MD("new"),&GDNativeClass::_new);
+ ClassDB::bind_method(D_METHOD("new"),&GDNativeClass::_new);
}
@@ -160,6 +160,8 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError&
_baseptr=_baseptr->_base;
}
+ ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant());
+
if (_baseptr->native.ptr()) {
owner=_baseptr->native->instance();
} else {
@@ -356,9 +358,11 @@ bool GDScript::get_property_default_value(const StringName& p_property, Variant
#ifdef TOOLS_ENABLED
- //for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) {
- // print_line("\t"+String(String(I->key())+":"+String(I->get())));
- //}
+ /*
+ for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) {
+ print_line("\t"+String(String(I->key())+":"+String(I->get())));
+ }
+ */
const Map<StringName,Variant>::Element *E=member_default_values_cache.find(p_property);
if (E) {
r_value=E->get();
@@ -537,7 +541,7 @@ bool GDScript::_update_exports() {
}
}
- members_cache.clear();;
+ members_cache.clear();
member_default_values_cache.clear();
for(int i=0;i<c->variables.size();i++) {
@@ -785,7 +789,7 @@ void GDScript::_bind_methods() {
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo(Variant::OBJECT,"new"));
- ClassDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code);
+ ClassDB::bind_method(D_METHOD("get_as_byte_code"),&GDScript::get_as_byte_code);
}
@@ -1513,6 +1517,8 @@ void GDScriptLanguage::init() {
}
_add_global(StaticCString::create("PI"),Math_PI);
+ _add_global(StaticCString::create("INF"),Math_INF);
+ _add_global(StaticCString::create("NAN"),Math_NAN);
//populate native classes
@@ -1860,7 +1866,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script>& p_script,bool p_sof
void GDScriptLanguage::frame() {
- // print_line("calls: "+itos(calls));
+ //print_line("calls: "+itos(calls));
calls=0;
#ifdef DEBUG_ENABLED
@@ -1905,6 +1911,8 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"bool",
"null",
"PI",
+ "INF",
+ "NAN",
"self",
"true",
// functions
@@ -1934,6 +1942,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"for",
"pass",
"return",
+ "match",
"while",
"remote",
"sync",
@@ -2066,7 +2075,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String& p_type) const {
String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const {
- String el = p_path.extension().to_lower();
+ String el = p_path.get_extension().to_lower();
if (el=="gd" || el=="gdc" || el=="gde")
return "GDScript";
return "";