Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions src/hx/cppia/CppiaVars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,9 @@ void CppiaVar::linkVarTypes(CppiaModule &cppia, int &ioOffset)
AlignOffset(exprType, ioOffset);
offset = ioOffset;

switch(exprType)
{
case etInt: ioOffset += sizeof(int); storeType=fsInt; break;
case etFloat: ioOffset += sizeof(Float);storeType=fsFloat; break;
case etString: ioOffset += sizeof(String);storeType=fsString; break;
case etObject: ioOffset += sizeof(hx::Object *);storeType=fsObject; break;
case etVoid:
case etNull:
break;
}
storeType = typeId==0 ? fsObject : fieldStorageFromType(type);

ioOffset += sTypeSize[exprType];
}
}

Expand Down
9 changes: 9 additions & 0 deletions test/cppia/Client.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ class ClientFoo implements IFoo {
}
}

class ClientBoolField {

public var flag:Bool = true;

public static var staticFlag:Bool = true;

public function new() {}
}

class Client
{
public static var clientBool0 = true;
Expand Down
12 changes: 12 additions & 0 deletions test/cppia/cases/TestCommon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ class TestCommon extends Test {
Assert.equals(2, Common.callbackSet, 'Bad cppia closure');
}

@:depends(testStatus)
function testBoolMemberStorage() {
final cls = Type.resolveClass('ClientBoolField');

if (Assert.notNull(cls, 'Unable to resolve ClientBoolField')) {
final obj = Type.createInstance(cls, []);

Assert.same(Type.ValueType.TBool, Type.typeof(Reflect.field(obj, 'flag')), 'Member Bool did not read back as a boolean');
Assert.same(Type.ValueType.TBool, Type.typeof(Reflect.field(cls, 'staticFlag')), 'Static Bool did not read back as a boolean');
}
}

@:depends(testStatus)
function testInterfaceCalling() {
final obj : IFoo = Type.createInstance(Type.resolveClass('ClientFoo'), []);
Expand Down