summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/cscript/godot_c.h28
-rw-r--r--modules/gdscript/gd_compiler.cpp4
-rw-r--r--modules/gdscript/gd_editor.cpp2
-rw-r--r--modules/gdscript/gd_function.h1
-rw-r--r--modules/gdscript/gd_parser.cpp2
-rw-r--r--modules/gdscript/gd_script.cpp17
6 files changed, 33 insertions, 21 deletions
diff --git a/modules/cscript/godot_c.h b/modules/cscript/godot_c.h
index b593c7d810..b0465d8524 100644
--- a/modules/cscript/godot_c.h
+++ b/modules/cscript/godot_c.h
@@ -6,7 +6,7 @@ extern "C" {
#endif
-#if defined(GDAPI_BUILT_IN) or !defined(WINDOWS_ENABLED)
+#if defined(GDAPI_BUILT_IN) || !defined(WINDOWS_ENABLED)
#define GDAPI
#elif defined(GDAPI_EXPORTS)
#define GDAPI __declspec(dllexport)
@@ -207,7 +207,7 @@ void GDAPI godot_byte_array_clear(godot_byte_array p_byte_array);
typedef void* godot_byte_array_lock;
godot_byte_array_lock GDAPI godot_byte_array_get_lock(godot_byte_array p_byte_array);
-unsigned char* GDAPI godot_byte_array_lock_get_pointer(godot_byte_array_lock p_byte_array_lock);
+unsigned char GDAPI *godot_byte_array_lock_get_pointer(godot_byte_array_lock p_byte_array_lock);
void GDAPI godot_byte_array_lock_free(godot_byte_array_lock p_byte_array_lock);
@@ -232,7 +232,7 @@ void GDAPI godot_int_array_clear(godot_int_array p_int_array);
typedef void* godot_int_array_lock;
godot_int_array_lock GDAPI godot_int_array_get_lock(godot_int_array p_int_array);
-int* GDAPI godot_int_array_lock_get_pointer(godot_int_array_lock p_int_array_lock);
+int GDAPI *godot_int_array_lock_get_pointer(godot_int_array_lock p_int_array_lock);
void GDAPI godot_int_array_lock_free(godot_int_array_lock p_int_array_lock);
////// RealArray
@@ -253,7 +253,7 @@ void GDAPI godot_real_array_clear(godot_real_array p_real_array);
typedef void* godot_real_array_lock;
godot_real_array_lock GDAPI godot_real_array_get_lock(godot_real_array p_real_array);
-float* GDAPI godot_real_array_lock_get_pointer(godot_real_array_lock p_real_array_lock);
+float GDAPI *godot_real_array_lock_get_pointer(godot_real_array_lock p_real_array_lock);
void GDAPI godot_real_array_lock_free(godot_real_array_lock p_real_array_lock);
@@ -291,7 +291,7 @@ void GDAPI godot_vector2_array_clear(godot_vector2_array p_vector2_array);
typedef void* godot_vector2_array_lock;
godot_vector2_array_lock GDAPI godot_vector2_array_get_lock(godot_vector2_array p_vector2_array);
-float* GDAPI godot_vector2_array_lock_get_pointer(godot_vector2_array_lock p_vector2_array_lock);
+float GDAPI *godot_vector2_array_lock_get_pointer(godot_vector2_array_lock p_vector2_array_lock);
void GDAPI godot_vector2_array_lock_free(godot_vector2_array_lock p_vector2_array_lock);
////// Vector3Array
@@ -313,7 +313,7 @@ void GDAPI godot_vector3_array_clear(godot_vector3_array p_vector3_array);
typedef void* godot_vector3_array_lock;
godot_vector3_array_lock GDAPI godot_vector3_array_get_lock(godot_vector3_array p_vector3_array);
-float* GDAPI godot_vector3_array_lock_get_pointer(godot_vector3_array_lock p_vector3_array_lock);
+float GDAPI *godot_vector3_array_lock_get_pointer(godot_vector3_array_lock p_vector3_array_lock);
void GDAPI godot_vector3_array_lock_free(godot_vector3_array_lock p_vector3_array_lock);
////// ColorArray
@@ -335,7 +335,7 @@ void GDAPI godot_color_array_clear(godot_color_array p_color_array);
typedef void* godot_color_array_lock;
godot_color_array_lock GDAPI godot_color_array_get_lock(godot_color_array p_color_array);
-float* GDAPI godot_color_array_lock_get_pointer(godot_color_array_lock p_color_array_lock);
+float GDAPI *godot_color_array_lock_get_pointer(godot_color_array_lock p_color_array_lock);
void GDAPI godot_color_array_lock_free(godot_color_array_lock p_color_array_lock);
@@ -421,7 +421,7 @@ void GDAPI godot_variant_get_aabb(godot_variant p_variant,float *p_elems);
void GDAPI godot_variant_get_matrix3(godot_variant p_variant,float *p_elems);
void GDAPI godot_variant_get_transform(godot_variant p_variant,float *p_elems);
void GDAPI godot_variant_get_color(godot_variant p_variant,float *p_elems);
-godot_image *GDAPI godot_variant_get_image(godot_variant p_variant);
+godot_image GDAPI *godot_variant_get_image(godot_variant p_variant);
int GDAPI godot_variant_get_node_path(godot_variant p_variant,char *p_path, int p_bufsize);
godot_rid GDAPI godot_variant_get_rid(godot_variant p_variant);
godot_instance GDAPI godot_variant_get_instance(godot_variant p_variant);
@@ -441,17 +441,17 @@ void GDAPI godot_variant_delete(godot_variant p_variant);
////// Class
///
-char** GDAPI godot_class_get_list(); //get list of classes in array to array of strings, must be freed, use godot_list_free()
+char GDAPI **godot_class_get_list(); //get list of classes in array to array of strings, must be freed, use godot_list_free()
int GDAPI godot_class_get_base(char* p_class,char *p_base,int p_max_len);
int GDAPI godot_class_get_name(char* p_class,char *p_base,int p_max_len);
-char** GDAPI godot_class_get_method_list(char* p_class); //free with godot_list_free()
+char GDAPI **godot_class_get_method_list(char* p_class); //free with godot_list_free()
int GDAPI godot_class_method_get_argument_count(char* p_class,char *p_method);
int GDAPI godot_class_method_get_argument_type(char* p_class,char *p_method,int p_argument);
godot_variant GDAPI godot_class_method_get_argument_default_value(char* p_class,char *p_method,int p_argument);
-char** GDAPI godot_class_get_constant_list(char* p_class); //free with godot_list_free()
+char GDAPI **godot_class_get_constant_list(char* p_class); //free with godot_list_free()
int GDAPI godot_class_constant_get_value(char* p_class,char *p_constant);
@@ -523,7 +523,7 @@ godot_variant GDAPI godot_instance_get(godot_instance p_instance, char* p_prop);
#define GODOT_PROPERTY_USAGE_NOEDITOR GODOT_PROPERTY_USAGE_STORAGE|GODOT_PROPERTY_USAGE_NETWORK
-godot_property_info** GDAPI godot_instance_get_property_list(godot_instance p_instance);
+godot_property_info GDAPI **godot_instance_get_property_list(godot_instance p_instance);
void GDAPI godot_instance_free_property_list(godot_instance p_instance,godot_property_info** p_list);
@@ -555,8 +555,8 @@ void GDAPI godot_script_add_listed_property(char* p_name,char* p_path,godot_set_
////// System Functions
//using these will help Godot track how much memory is in use in debug mode
-void* GDAPI godot_alloc(int p_bytes);
-void* GDAPI godot_realloc(void* p_ptr,int p_bytes);
+void GDAPI *godot_alloc(int p_bytes);
+void GDAPI *godot_realloc(void* p_ptr,int p_bytes);
void GDAPI godot_free(void* p_ptr);
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 7481eac620..d9bbe42979 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1497,7 +1497,8 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
String sub = p_class->extends_class[i];
if (script->subclasses.has(sub)) {
- script=script->subclasses[sub];
+ Ref<Script> subclass = script->subclasses[sub]; //avoid reference from dissapearing
+ script=subclass;
} else {
_set_error("Could not find subclass: "+sub,p_class);
@@ -1683,6 +1684,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
if (err)
return err;
+
p_script->constants.insert(name,subclass); //once parsed, goes to the list of constants
p_script->subclasses.insert(name,subclass);
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index b1da7e782c..07a5a636d4 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -212,7 +212,7 @@ String GDScriptLanguage::debug_get_stack_level_source(int p_level) const {
ERR_FAIL_INDEX_V(p_level,_debug_call_stack_pos,"");
int l = _debug_call_stack_pos - p_level -1;
- return _call_stack[l].function->get_script()->get_path();
+ return _call_stack[l].function->get_source();
}
void GDScriptLanguage::debug_get_stack_level_locals(int p_level,List<String> *p_locals, List<Variant> *p_values, int p_max_subitems,int p_max_depth) {
diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h
index 1f790eaadc..942db170c8 100644
--- a/modules/gdscript/gd_function.h
+++ b/modules/gdscript/gd_function.h
@@ -160,6 +160,7 @@ public:
int get_default_argument_count() const;
int get_default_argument_addr(int p_idx) const;
GDScript *get_script() const { return _script; }
+ StringName get_source() const { return source; }
void debug_get_stack_member_state(int p_line,List<Pair<StringName,int> > *r_stackvars) const;
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 3ef42f81a4..e83bd3d21e 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -477,7 +477,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
} else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) {
//identifier (reference)
- const ClassNode* cln = static_cast<const ClassNode*>(get_parse_tree());
+ const ClassNode* cln = current_class;
bool bfn = false;
StringName identifier;
if (_get_completable_identifier(COMPLETION_IDENTIFIER,identifier)) {
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index e37a2ca155..d9783c218a 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -874,6 +874,10 @@ GDScript::~GDScript() {
memdelete( E->get() );
}
+ for (Map<StringName,Ref<GDScript> >::Element *E=subclasses.front();E;E=E->next()) {
+ E->get()->_owner=NULL; //bye, you are no longer owned cause I died
+ }
+
#ifdef DEBUG_ENABLED
if (GDScriptLanguage::get_singleton()->lock) {
GDScriptLanguage::get_singleton()->lock->lock();
@@ -960,11 +964,16 @@ bool GDInstance::get(const StringName& p_name, Variant &r_ret) const {
}
{
- const Map<StringName,Variant>::Element *E = script->constants.find(p_name);
- if (E) {
- r_ret=E->get();
- return true; //index found
+ const GDScript *sl = sptr;
+ while(sl) {
+ const Map<StringName,Variant>::Element *E = sl->constants.find(p_name);
+ if (E) {
+ r_ret=E->get();
+ return true; //index found
+
+ }
+ sl=sl->_base;
}
}