summaryrefslogtreecommitdiffstats
path: root/binding_generator/src/main.rs
diff options
context:
space:
mode:
authorKarroffel <therzog@mail.de>2017-04-17 21:29:47 +0200
committerKarroffel <therzog@mail.de>2017-04-17 21:29:47 +0200
commitb9e5611cfb9e9f04507676bef81cfe2a3abb96b2 (patch)
tree3dcbf0925ed94cac0707d7d3bdb74f2a88639a5a /binding_generator/src/main.rs
parent005b9aa148dc0010890dec6e157b5359da790ecc (diff)
downloadredot-cpp-b9e5611cfb9e9f04507676bef81cfe2a3abb96b2.tar.gz
reverted weird reference stuff
Diffstat (limited to 'binding_generator/src/main.rs')
-rw-r--r--binding_generator/src/main.rs31
1 files changed, 7 insertions, 24 deletions
diff --git a/binding_generator/src/main.rs b/binding_generator/src/main.rs
index 208d9ba..6d25386 100644
--- a/binding_generator/src/main.rs
+++ b/binding_generator/src/main.rs
@@ -490,7 +490,7 @@ fn generate_class_implementation(icalls: &mut HashSet<(String, Vec<String>)>, us
if is_core_type(t) || is_primitive(t) {
t.clone()
} else {
- t.clone()
+ String::from("Object")
}
}
@@ -586,8 +586,7 @@ fn generate_icall_header(icalls: &HashSet<(String, Vec<String>)>) -> String {
if is_primitive(t) || is_core_type(t) {
t.clone()
} else {
- let s = String::new() + t.as_str() + " *";
- s
+ String::from("Object *")
}
}
@@ -600,24 +599,9 @@ fn generate_icall_header(icalls: &HashSet<(String, Vec<String>)>) -> String {
contents = contents + "#include <godot.h>\n\n\n";
contents = contents + "#include \"core/CoreTypes.hpp\"\n";
- // contents = contents + "#include \"Object.hpp\"\n\n\n";
+ contents = contents + "#include \"Object.hpp\"\n\n\n";
- let mut types_used = HashSet::new();
- for &(ref ret, ref args) in icalls {
- if !is_primitive(ret) && !is_core_type(ret) {
- types_used.insert(ret.clone());
- }
- for arg in args {
- if !is_core_type(&arg) && !is_primitive(&arg) {
- types_used.insert(arg.clone());
- }
- }
- }
-
- for ref type_ in types_used {
- contents = contents + "#include \"" + strip_name(type_) + ".hpp\"\n\n\n";
- }
contents = contents + "using namespace godot;\n\n\n";
@@ -631,7 +615,7 @@ fn generate_icall_header(icalls: &HashSet<(String, Vec<String>)>) -> String {
} else if is_primitive(&arg) {
contents = contents + "const " + arg.as_str() + " ";
} else {
- contents = contents + "const " + arg.as_str() + " *";
+ contents = contents + "const Object *";
}
}
contents = contents + ");\n";
@@ -695,9 +679,8 @@ fn generate_icall_implementation(class_api: &Vec<GodotClass>, icalls: &HashSet<(
if ret != "void" {
contents = contents + "\t" + strip_name(ret) + if !is_core_type(ret) && !is_primitive(ret) { " *" } else { "" } + " ret;\n";
- if !is_core_type(ret) && !is_primitive(ret) && is_reference(ret) {
- println!("{} is ref", ret);
- contents = contents + "\t" + "ret = " + strip_name(ret) + "::_new();\n";
+ if !is_core_type(ret) && !is_primitive(ret) {
+ contents = contents + "\t" + "ret = nullptr;\n";
}
}
@@ -786,4 +769,4 @@ fn escape_cpp(name: &String) -> &str {
"new" => "new_",
x => x
}
-} \ No newline at end of file
+}