bug fixes

This commit is contained in:
Adam D. Ruppe 2020-05-08 08:49:44 -04:00
parent d0aec8e606
commit 643d548245
1 changed files with 7 additions and 1 deletions

View File

@ -2165,6 +2165,9 @@ WrappedNativeObject wrapNativeObject(Class, bool special = false)(Class obj) if(
gen._function = delegate (var vthis_, var[] vargs) { gen._function = delegate (var vthis_, var[] vargs) {
Parameters!(__traits(getOverloads, Class, memberName)[idx]) args; Parameters!(__traits(getOverloads, Class, memberName)[idx]) args;
// FIXME: what if there are multiple @scriptable overloads?!
// FIXME: what about @properties?
foreach(idx, ref arg; args) foreach(idx, ref arg; args)
if(idx < vargs.length) if(idx < vargs.length)
arg = vargs[idx].get!(typeof(arg)); arg = vargs[idx].get!(typeof(arg));
@ -2172,6 +2175,8 @@ WrappedNativeObject wrapNativeObject(Class, bool special = false)(Class obj) if(
static if(special) { static if(special) {
Class obj; Class obj;
//if(vthis_.payloadType() != var.Type.Object) { import std.stdio; writeln("getwno on ", vthis_); } //if(vthis_.payloadType() != var.Type.Object) { import std.stdio; writeln("getwno on ", vthis_); }
// the native object might be a step or two up the prototype
// chain due to script subclasses, need to find it...
while(vthis_ != null) { while(vthis_ != null) {
obj = vthis_.getWno!Class; obj = vthis_.getWno!Class;
if(obj !is null) if(obj !is null)
@ -2296,6 +2301,7 @@ bool isScriptable(attributes...)() {
bool isScriptableOpaque(T)() { bool isScriptableOpaque(T)() {
static if(is(typeof(T.isOpaqueStruct) == bool)) static if(is(typeof(T.isOpaqueStruct) == bool))
return T.isOpaqueStruct == true; return T.isOpaqueStruct == true;
else
return false; return false;
} }