Skip to content

Commit

Permalink
Static methods now generate static properties, with error checking fo…
Browse files Browse the repository at this point in the history
…r static mismatch
  • Loading branch information
JoshEngebretson committed Jun 20, 2017
1 parent f592f88 commit e0ea191
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Script/AtomicNET/AtomicNET/Core/AtomicNET.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static void Initialize()
if (core != null)
AtomicNET.RegisterSubsystem(core);

context = core.Context;
context = NETCore.Context;

NativeCore.Initialize();
CSComponentCore.Initialize();
Expand Down
23 changes: 21 additions & 2 deletions Source/ToolCore/JSBind/CSharp/CSClassWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ void CSClassWriter::WriteManagedProperties(String& sourceOut)
JSBFunctionType* fType = NULL;
JSBFunctionType* getType = NULL;
JSBFunctionType* setType = NULL;
bool getStatic = false;
bool setStatic = false;

if (CSTypeHelper::OmitFunction(prop->getter_) || CSTypeHelper::OmitFunction(prop->setter_))
continue;
Expand All @@ -118,22 +120,39 @@ void CSClassWriter::WriteManagedProperties(String& sourceOut)

if (prop->getter_ && !prop->getter_->Skip())
{
fType = getType = prop->getter_->GetReturnType();
getStatic = prop->getter_->IsStatic();
fType = getType = prop->getter_->GetReturnType();
}

if (prop->setter_ && !prop->setter_->Skip())
{
setStatic = prop->setter_->IsStatic();
setType = prop->setter_->GetParameters()[0];

if (!fType)
{
fType = setType;
}
else if (fType->type_->ToString() != setType->type_->ToString())
{
continue;
}
else if (getStatic != setStatic)
{
ATOMIC_LOGWARNINGF("CSClassWriter::WriteManagedProperties : mismatched static qualifier on property %s:%s",
klass_->GetName().CString(), prop->name_.CString());

continue;
}
}

if (!fType)
continue;

String line = klass_->IsInterface() ? "" : "public ";
String line = (klass_->IsInterface() ? "" : "public ");

if (getStatic)
line += "static ";

JSBClass* baseClass = klass_->GetBaseClass();
if (baseClass)
Expand Down

0 comments on commit e0ea191

Please sign in to comment.