Browse Source

Static methods now generate static properties, with error checking for static mismatch

Josh Engebretson 8 years ago
parent
commit
e0ea191253

+ 1 - 1
Script/AtomicNET/AtomicNET/Core/AtomicNET.cs

@@ -123,7 +123,7 @@ namespace AtomicEngine
             if (core != null)
             if (core != null)
                 AtomicNET.RegisterSubsystem(core);
                 AtomicNET.RegisterSubsystem(core);
 
 
-            context = core.Context;            
+            context = NETCore.Context;
 
 
             NativeCore.Initialize();
             NativeCore.Initialize();
             CSComponentCore.Initialize();            
             CSComponentCore.Initialize();            

+ 21 - 2
Source/ToolCore/JSBind/CSharp/CSClassWriter.cpp

@@ -101,6 +101,8 @@ void CSClassWriter::WriteManagedProperties(String& sourceOut)
             JSBFunctionType* fType = NULL;
             JSBFunctionType* fType = NULL;
             JSBFunctionType* getType = NULL;
             JSBFunctionType* getType = NULL;
             JSBFunctionType* setType = NULL;
             JSBFunctionType* setType = NULL;
+            bool getStatic = false;
+            bool setStatic = false;
 
 
             if (CSTypeHelper::OmitFunction(prop->getter_) || CSTypeHelper::OmitFunction(prop->setter_))
             if (CSTypeHelper::OmitFunction(prop->getter_) || CSTypeHelper::OmitFunction(prop->setter_))
                 continue;
                 continue;
@@ -118,22 +120,39 @@ void CSClassWriter::WriteManagedProperties(String& sourceOut)
 
 
             if (prop->getter_ && !prop->getter_->Skip())
             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())
             if (prop->setter_ && !prop->setter_->Skip())
             {
             {
+                setStatic = prop->setter_->IsStatic();
                 setType = prop->setter_->GetParameters()[0];
                 setType = prop->setter_->GetParameters()[0];
 
 
                 if (!fType)
                 if (!fType)
+                {
                     fType = setType;
                     fType = setType;
+                }
                 else if (fType->type_->ToString() != setType->type_->ToString())
                 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;
                     continue;
+                }
             }
             }
 
 
             if (!fType)
             if (!fType)
                 continue;
                 continue;
 
 
-            String line = klass_->IsInterface() ? "" : "public ";
+            String line = (klass_->IsInterface() ? "" : "public ");
+
+            if (getStatic)
+                line += "static ";
 
 
             JSBClass* baseClass = klass_->GetBaseClass();
             JSBClass* baseClass = klass_->GetBaseClass();
             if (baseClass)
             if (baseClass)