Browse Source

Adding support for interfaces (C#)

Josh Engebretson 9 years ago
parent
commit
4e52e5d9ee

+ 2 - 0
Script/AtomicNET/AtomicNET/Core/RefCounted.cs

@@ -33,6 +33,8 @@ namespace AtomicEngine
             return refCounted.nativeInstance;
             return refCounted.nativeInstance;
         }
         }
 
 
+        public IntPtr NativeInstance { get { return nativeInstance; } }
+
         public IntPtr nativeInstance = IntPtr.Zero;
         public IntPtr nativeInstance = IntPtr.Zero;
 
 
         [DllImport(Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
         [DllImport(Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]

+ 13 - 0
Script/AtomicNET/AtomicNET/IO/Deserializer.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace AtomicEngine
+{
+
+    public interface Deserializer
+    {
+        IntPtr NativeInstance { get; }
+    }
+
+
+}

+ 12 - 0
Script/AtomicNET/AtomicNET/IO/Serializer.cs

@@ -0,0 +1,12 @@
+using System;
+namespace AtomicEngine
+{
+
+    public interface Serializer
+    {
+        IntPtr NativeInstance { get; }
+
+    }
+
+
+}

+ 2 - 1
Script/Packages/Atomic/IO.json

@@ -2,6 +2,7 @@
 	"name" : "IO",
 	"name" : "IO",
 	"sources" : ["Source/Atomic/IO"],
 	"sources" : ["Source/Atomic/IO"],
 	"classes" : ["Log", "File", "FileSystem", "FileWatcher", "BufferQueue"],
 	"classes" : ["Log", "File", "FileSystem", "FileWatcher", "BufferQueue"],
+	"interfaces" : ["Serializer", "Deserializer"],
 	"overloads" : {
 	"overloads" : {
 		"File" : {
 		"File" : {
 			"File" : ["Context", "String", "FileMode"]
 			"File" : ["Context", "String", "FileMode"]
@@ -16,7 +17,7 @@
 			"scanDir(pathName:string, filter:string, flags:number, recursive:boolean):Array<string>;"
 			"scanDir(pathName:string, filter:string, flags:number, recursive:boolean):Array<string>;"
 		]
 		]
 	},
 	},
-	
+
 	"haxe_decl" : {
 	"haxe_decl" : {
 		"File" : [
 		"File" : [
 			"function readText():String;",
 			"function readText():String;",

+ 18 - 1
Source/ToolCore/JSBind/CSharp/CSClassWriter.cpp

@@ -202,7 +202,24 @@ void CSClassWriter::GenerateManagedSource(String& sourceOut)
 
 
     if (klass_->GetBaseClass())
     if (klass_->GetBaseClass())
     {
     {
-        line = ToString("public partial class %s%s : %s\n", klass_->GetName().CString(), klass_->IsGeneric() ? "<T>" : "", klass_->GetBaseClass()->GetName().CString());
+
+        String baseString = klass_->GetBaseClass()->GetName();
+
+        const PODVector<JSBClass*>& interfaces = klass_->GetInterfaces();
+
+        if (interfaces.Size())
+        {
+            StringVector baseStrings;
+            baseStrings.Push(baseString);
+            for (unsigned i = 0; i < interfaces.Size(); i++)
+            {
+                baseStrings.Push(interfaces.At(i)->GetName());
+            }
+
+            baseString = String::Joined(baseStrings, ",");
+        }
+
+        line = ToString("public partial class %s%s : %s\n", klass_->GetName().CString(), klass_->IsGeneric() ? "<T>" : "", baseString.CString());
     }
     }
     else
     else
     {
     {

+ 1 - 1
Source/ToolCore/JSBind/CSharp/CSFunctionWriter.cpp

@@ -632,7 +632,7 @@ void CSFunctionWriter::GenPInvokeCallParameters(String& sig)
                 }
                 }
                 else
                 else
                 {
                 {
-                    sig += name + " == null ? IntPtr.Zero : " + name + ".nativeInstance";
+                    sig += name + " == null ? IntPtr.Zero : " + name + ".NativeInstance";
                 }
                 }
 
 
             }
             }

+ 8 - 6
Source/ToolCore/JSBind/CSharp/CSModuleWriter.cpp

@@ -64,10 +64,12 @@ void CSModuleWriter::WriteIncludes(String& source)
         eitr++;
         eitr++;
     }
     }
 
 
-    HashMap<StringHash, SharedPtr<JSBClass> >::Iterator citr = module_->classes_.Begin();
-    while (citr != module_->classes_.End())
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
+
+    Vector<SharedPtr<JSBClass>>::Iterator citr = classes.Begin();
+    while (citr != classes.End())
     {
     {
-        allheaders.Push(citr->second_->GetHeader());
+        allheaders.Push((*citr)->GetHeader());
         citr++;
         citr++;
     }
     }
 
 
@@ -143,7 +145,7 @@ void CSModuleWriter::GenerateNativeSource()
 
 
     source += "// Begin Classes\n";
     source += "// Begin Classes\n";
 
 
-    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
 
 
     for (unsigned i = 0; i < classes.Size(); i++)
     for (unsigned i = 0; i < classes.Size(); i++)
     {
     {
@@ -208,7 +210,7 @@ String CSModuleWriter::GetManagedPrimitiveType(JSBPrimitiveType* ptype)
 void CSModuleWriter::GenerateManagedClasses(String& source)
 void CSModuleWriter::GenerateManagedClasses(String& source)
 {
 {
 
 
-    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
 
 
     for (unsigned i = 0; i < classes.Size(); i++)
     for (unsigned i = 0; i < classes.Size(); i++)
     {
     {
@@ -526,7 +528,7 @@ void CSModuleWriter::GenerateManagedModuleClass(String& sourceOut)
 
 
     Indent();
     Indent();
 
 
-    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
 
 
     for (unsigned i = 0; i < classes.Size(); i++)
     for (unsigned i = 0; i < classes.Size(); i++)
     {
     {

+ 2 - 2
Source/ToolCore/JSBind/JSBClass.cpp

@@ -124,9 +124,9 @@ bool JSBFunctionSignature::Match(JSBFunction* function)
 
 
 }
 }
 
 
-JSBClass::JSBClass(Context* context, JSBModule *module, const String& name, const String& nativeName) : Object(context),
+JSBClass::JSBClass(Context* context, JSBModule *module, const String& name, const String& nativeName, bool interface) : Object(context),
     module_(module), name_(name), nativeName_(nativeName),
     module_(module), name_(name), nativeName_(nativeName),
-    isAbstract_(false), isObject_(false), isGeneric_(false),
+    isAbstract_(false), isObject_(false), isGeneric_(false), isInterface_(interface),
     numberArrayElements_(0), arrayElementType_("float"),
     numberArrayElements_(0), arrayElementType_("float"),
     hasProperties_(false)
     hasProperties_(false)
 {
 {

+ 10 - 3
Source/ToolCore/JSBind/JSBClass.h

@@ -121,7 +121,7 @@ class JSBClass : public Object
 
 
 public:
 public:
 
 
-    JSBClass(Context* context, JSBModule* module, const String& name, const String& nativeName);
+    JSBClass(Context* context, JSBModule* module, const String& name, const String& nativeName, bool interface);
     virtual ~JSBClass();
     virtual ~JSBClass();
 
 
     const String& GetName() const { return name_; }
     const String& GetName() const { return name_; }
@@ -133,8 +133,9 @@ public:
     // Get all functions, including those in base classes
     // Get all functions, including those in base classes
     void GetAllFunctions(PODVector<JSBFunction*>& functions);
     void GetAllFunctions(PODVector<JSBFunction*>& functions);
 
 
-    bool IsGeneric() { return isGeneric_; }
-    bool IsAbstract() { return isAbstract_; }
+    bool IsGeneric() const { return isGeneric_; }
+    bool IsAbstract() const { return isAbstract_; }
+    bool IsInterface() const { return isInterface_; }
 
 
     /// Note that if we at some point want to generate bindings for JSBClass
     /// Note that if we at some point want to generate bindings for JSBClass
     /// this override will need to be addressed, as we'll need to know that JSBClass is
     /// this override will need to be addressed, as we'll need to know that JSBClass is
@@ -165,6 +166,8 @@ public:
 
 
     JSBFunction* GetConstructor(BindingLanguage bindingLanguage = BINDINGLANGUAGE_ANY );
     JSBFunction* GetConstructor(BindingLanguage bindingLanguage = BINDINGLANGUAGE_ANY );
 
 
+    const PODVector<JSBClass*>& GetInterfaces() const { return interfaces_; }
+
     void SetAbstract(bool value = true) { isAbstract_ = value; }
     void SetAbstract(bool value = true) { isAbstract_ = value; }
     void SetObject(bool value = true) { isObject_ = value; }
     void SetObject(bool value = true) { isObject_ = value; }
     void SetGeneric(bool value = true) { isGeneric_ = value; }
     void SetGeneric(bool value = true) { isGeneric_ = value; }
@@ -178,6 +181,8 @@ public:
     void AddFunctionExclude(JSBFunctionSignature* exclude) { excludes_.Push(exclude); }
     void AddFunctionExclude(JSBFunctionSignature* exclude) { excludes_.Push(exclude); }
     void AddPropertyFunction(JSBFunction* function);
     void AddPropertyFunction(JSBFunction* function);
 
 
+    void AddInterface(JSBClass* klass) { interfaces_.Push(klass); }
+
     void AddTypeScriptDecl(const String& decl) { typeScriptDecls_.Push(decl); }
     void AddTypeScriptDecl(const String& decl) { typeScriptDecls_.Push(decl); }
     unsigned GetNumTypeScriptDecl() { return typeScriptDecls_.Size(); }
     unsigned GetNumTypeScriptDecl() { return typeScriptDecls_.Size(); }
     const String& GetTypeScriptDecl(unsigned idx) { return typeScriptDecls_[idx]; }
     const String& GetTypeScriptDecl(unsigned idx) { return typeScriptDecls_[idx]; }
@@ -204,6 +209,7 @@ private:
 
 
     PODVector<JSBFunction*> functions_;
     PODVector<JSBFunction*> functions_;
     PODVector<JSBClass*> baseClasses_;
     PODVector<JSBClass*> baseClasses_;
+    PODVector<JSBClass*> interfaces_;
 
 
     PODVector<JSBFunctionSignature*> overrides_;
     PODVector<JSBFunctionSignature*> overrides_;
     PODVector<JSBFunctionSignature*> excludes_;
     PODVector<JSBFunctionSignature*> excludes_;
@@ -214,6 +220,7 @@ private:
     bool isAbstract_;
     bool isAbstract_;
     bool isObject_;
     bool isObject_;
     bool isGeneric_;
     bool isGeneric_;
+    bool isInterface_;
 
 
     String docString_;
     String docString_;
 
 

+ 21 - 3
Source/ToolCore/JSBind/JSBHeaderVisitor.h

@@ -144,7 +144,7 @@ public:
             }
             }
             else
             else
             {
             {
-                JSBClass* jclass = JSBPackage::GetClassAllPackages(classname);
+                JSBClass* jclass = JSBPackage::GetClassAllPackages(classname, true);
 
 
                 if (jclass)
                 if (jclass)
                     jtype = new JSBClassType(jclass);
                     jtype = new JSBClassType(jclass);
@@ -484,6 +484,12 @@ public:
 
 
                     JSBFunctionType* ftype = processFunctionArgType(arg);
                     JSBFunctionType* ftype = processFunctionArgType(arg);
 
 
+                    // TODO: expose interfaces to TS
+                    if (ftype && ftype->type_->asClassType() && ftype->type_->asClassType()->class_->IsInterface())
+                    {
+                        jfunction->SetSkipLanguage(BINDINGLANGUAGE_JAVASCRIPT);
+                    }
+
                     if (!ftype)
                     if (!ftype)
                     {
                     {
                         // if we don't have an initializer, the function cannot be bound
                         // if we don't have an initializer, the function cannot be bound
@@ -608,7 +614,7 @@ public:
     {
     {
         String name = getNameString(klass->name());
         String name = getNameString(klass->name());
 
 
-        JSBClass* jclass = module_->GetClass(name);
+        JSBClass* jclass = module_->GetClass(name, true);
 
 
         if (!jclass)
         if (!jclass)
         {
         {
@@ -617,6 +623,9 @@ public:
 
 
         jclass->SetHeader(header_);
         jclass->SetHeader(header_);
 
 
+        if (jclass->IsInterface())
+            return true;
+
         String docString = parseDocString(klass->line() - 1);
         String docString = parseDocString(klass->line() - 1);
         if (docString.Length())
         if (docString.Length())
             jclass->SetDocString(docString);
             jclass->SetDocString(docString);
@@ -630,7 +639,16 @@ public:
 
 
             if (!base)
             if (!base)
             {
             {
-                ATOMIC_LOGINFOF("Warning: %s baseclass %s not in bindings", name.CString(), baseclassname.CString());
+                JSBClass* interface = JSBPackage::GetClassAllPackages(baseclassname, true);
+
+                if (interface)
+                {
+                    jclass->AddInterface(interface);
+                }
+                else
+                {
+                    ATOMIC_LOGINFOF("Warning: %s baseclass %s not in bindings", name.CString(), baseclassname.CString());
+                }
             }
             }
             else
             else
             {
             {

+ 40 - 7
Source/ToolCore/JSBind/JSBModule.cpp

@@ -55,9 +55,21 @@ JSBModule::~JSBModule()
 
 
 }
 }
 
 
-Vector<SharedPtr<JSBClass>> JSBModule::GetClasses()
+Vector<SharedPtr<JSBClass>> JSBModule::GetClasses(bool includeInterfaces)
 {
 {
-    return classes_.Values();
+    if (includeInterfaces)
+        return classes_.Values();
+
+    Vector<SharedPtr<JSBClass>> retValue;
+
+    Vector<SharedPtr<JSBClass>> classes = classes_.Values();
+
+    for (unsigned i = 0; i < classes.Size(); i++)
+        if (!classes[i]->IsInterface())
+            retValue.Push(classes[i]);
+
+    return retValue;
+
 }
 }
 
 
 Vector<SharedPtr<JSBEnum>> JSBModule::GetEnums()
 Vector<SharedPtr<JSBEnum>> JSBModule::GetEnums()
@@ -382,10 +394,17 @@ void JSBModule::ScanHeaders()
 
 
 }
 }
 
 
-JSBClass* JSBModule::GetClass(const String& name)
+JSBClass* JSBModule::GetClass(const String& name, bool includeInterfaces)
 {
 {
     if (classes_.Contains(name))
     if (classes_.Contains(name))
-        return classes_[name];
+    {
+        JSBClass* klass = classes_[name];
+
+        if (!includeInterfaces && klass->IsInterface())
+            return 0;
+
+        return klass;
+    }
 
 
     return 0;
     return 0;
 }
 }
@@ -394,19 +413,25 @@ void JSBModule::RegisterClass(String name)
 {
 {
     String nativeName = name;
     String nativeName = name;
 
 
-    if (classnames_.Contains(name))
+    if (classnames_.Contains(name) || interfaceNames_.Contains(name))
     {
     {
         if (classRenames_.Contains(name))
         if (classRenames_.Contains(name))
         {
         {
             name = classRenames_[name];
             name = classRenames_[name];
         }
         }
 
 
-        if (JSBPackage::GetClassAllPackages(nativeName))
+        if (JSBPackage::GetClassAllPackages(nativeName, true))
         {
         {
             ErrorExit(ToString("Class collision: %s", name.CString()));
             ErrorExit(ToString("Class collision: %s", name.CString()));
         }
         }
 
 
-        JSBClass* cls = new JSBClass(context_, this, name, nativeName);
+        bool interface = false;
+        if (interfaceNames_.Contains(nativeName))
+        {
+            interface = true;
+        }
+
+        JSBClass* cls = new JSBClass(context_, this, name, nativeName, interface);
 
 
         if (genericClassnames_.Contains(name))
         if (genericClassnames_.Contains(name))
         {
         {
@@ -707,6 +732,14 @@ bool JSBModule::Load(const String& jsonFilename)
 
 
     }
     }
 
 
+    JSONArray interfaces = root.Get("interfaces").GetArray();
+
+    for (unsigned i = 0; i < interfaces.Size(); i++)
+    {
+        interfaceNames_.Push(interfaces[i].GetString());
+    }
+
+
     JSONValue includes = root.Get("includes");
     JSONValue includes = root.Get("includes");
 
 
     if (includes.IsArray())
     if (includes.IsArray())

+ 3 - 2
Source/ToolCore/JSBind/JSBModule.h

@@ -65,8 +65,8 @@ public:
     const String& GetName() { return name_; }
     const String& GetName() { return name_; }
     JSBPackage* GetPackage() { return package_; }
     JSBPackage* GetPackage() { return package_; }
 
 
-    JSBClass* GetClass(const String& name);
-    Vector<SharedPtr<JSBClass>> GetClasses();
+    JSBClass* GetClass(const String& name, bool includeInterfaces = false);
+    Vector<SharedPtr<JSBClass>> GetClasses(bool includeInterfaces = false);
     Vector<SharedPtr<JSBEnum>> GetEnums();
     Vector<SharedPtr<JSBEnum>> GetEnums();
     HashMap<String, Constant>& GetConstants() { return constants_; }
     HashMap<String, Constant>& GetConstants() { return constants_; }
 
 
@@ -125,6 +125,7 @@ private:
 
 
     Vector<String> sourceDirs_;
     Vector<String> sourceDirs_;
     Vector<String> classnames_;
     Vector<String> classnames_;
+    Vector<String> interfaceNames_;
 
 
     Vector<String> genericClassnames_;
     Vector<String> genericClassnames_;
 
 

+ 21 - 4
Source/ToolCore/JSBind/JSBPackage.cpp

@@ -27,6 +27,7 @@
 
 
 #include "JSBind.h"
 #include "JSBind.h"
 #include "JSBEvent.h"
 #include "JSBEvent.h"
+#include "JSBClass.h"
 #include "JSBModule.h"
 #include "JSBModule.h"
 #include "JSBPackage.h"
 #include "JSBPackage.h"
 #include "JSBPackageWriter.h"
 #include "JSBPackageWriter.h"
@@ -91,11 +92,11 @@ void JSBPackage::GenerateSource(JSBPackageWriter& packageWriter)
     packageWriter.PostProcess();
     packageWriter.PostProcess();
 }
 }
 
 
-JSBClass* JSBPackage::GetClass(const String& name)
+JSBClass* JSBPackage::GetClass(const String& name, bool includeInterfaces)
 {
 {
     for (unsigned i = 0; i < modules_.Size(); i++)
     for (unsigned i = 0; i < modules_.Size(); i++)
     {
     {
-        JSBClass* cls = modules_[i]->GetClass(name);
+        JSBClass* cls = modules_[i]->GetClass(name, includeInterfaces);
         if (cls)
         if (cls)
             return cls;
             return cls;
     }
     }
@@ -103,11 +104,27 @@ JSBClass* JSBPackage::GetClass(const String& name)
     return 0;
     return 0;
 }
 }
 
 
-JSBClass* JSBPackage::GetClassAllPackages(const String& name)
+PODVector<JSBClass*> JSBPackage::GetAllClasses(bool includeInterfaces)
+{
+    PODVector<JSBClass*> retVector;
+
+    for (unsigned i = 0; i < allClasses_.Size(); i++)
+    {
+        if (!includeInterfaces && allClasses_[i]->IsInterface())
+            continue;
+
+        retVector.Push(allClasses_[i]);
+    }
+
+    return retVector;
+
+}
+
+JSBClass* JSBPackage::GetClassAllPackages(const String& name, bool includeInterfaces)
 {
 {
     for (unsigned i = 0; i < allPackages_.Size(); i++)
     for (unsigned i = 0; i < allPackages_.Size(); i++)
     {
     {
-        JSBClass* cls = allPackages_[i]->GetClass(name);
+        JSBClass* cls = allPackages_[i]->GetClass(name, includeInterfaces);
         if (cls)
         if (cls)
             return cls;
             return cls;
     }
     }

+ 3 - 3
Source/ToolCore/JSBind/JSBPackage.h

@@ -68,13 +68,13 @@ public:
     /// Returns whether bindings for a specific type should be generated for this package
     /// Returns whether bindings for a specific type should be generated for this package
     bool GenerateBindings(BindingType type) { return bindingTypes_.Contains(type); }
     bool GenerateBindings(BindingType type) { return bindingTypes_.Contains(type); }
 
 
-    JSBClass* GetClass(const String& name);
+    JSBClass* GetClass(const String& name, bool includeInterfaces = false);
 
 
-    PODVector<JSBClass*>& GetAllClasses() { return allClasses_; }
+    PODVector<JSBClass*> GetAllClasses(bool includeInterfaces = false);
     void RegisterClass(JSBClass* cls) {allClasses_.Push(cls); }
     void RegisterClass(JSBClass* cls) {allClasses_.Push(cls); }
 
 
     // get a class by name across all loaded packages
     // get a class by name across all loaded packages
-    static JSBClass* GetClassAllPackages(const String& name);
+    static JSBClass* GetClassAllPackages(const String& name, bool includeInterfaces = false);
 
 
     JSBEnum* GetEnum(const String& name);
     JSBEnum* GetEnum(const String& name);
 
 

+ 9 - 7
Source/ToolCore/JSBind/JavaScript/JSModuleWriter.cpp

@@ -44,7 +44,7 @@ JSModuleWriter::JSModuleWriter(JSBModule *module) : JSBModuleWriter(module)
 
 
 void JSModuleWriter::WriteForwardDeclarations(String& source)
 void JSModuleWriter::WriteForwardDeclarations(String& source)
 {
 {
-    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
 
 
     for (unsigned i = 0; i < classes.Size(); i++)
     for (unsigned i = 0; i < classes.Size(); i++)
     {
     {
@@ -61,7 +61,7 @@ void JSModuleWriter::WriteForwardDeclarations(String& source)
 
 
 void JSModuleWriter::WriteClassDeclaration(String& source)
 void JSModuleWriter::WriteClassDeclaration(String& source)
 {
 {
-    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
 
 
     source += "static void jsb_declare_classes(JSVM* vm)\n{\n";
     source += "static void jsb_declare_classes(JSVM* vm)\n{\n";
 
 
@@ -139,10 +139,12 @@ void JSModuleWriter::WriteIncludes(String& source)
         eitr++;
         eitr++;
     }
     }
 
 
-    HashMap<StringHash, SharedPtr<JSBClass> >::Iterator citr = module_->classes_.Begin();
-    while (citr != module_->classes_.End())
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
+
+    Vector<SharedPtr<JSBClass>>::Iterator citr = classes.Begin();
+    while (citr != classes.End())
     {
     {
-        allheaders.Push(citr->second_->GetHeader());
+        allheaders.Push((*citr)->GetHeader());
         citr++;
         citr++;
     }
     }
 
 
@@ -188,7 +190,7 @@ void JSModuleWriter::WritePreamble(String& source)
 
 
 void JSModuleWriter::WriteClassDefine(String& source)
 void JSModuleWriter::WriteClassDefine(String& source)
 {
 {
-    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
 
 
     source += "static void jsb_init_classes(JSVM* vm)\n{\n";
     source += "static void jsb_init_classes(JSVM* vm)\n{\n";
 
 
@@ -306,7 +308,7 @@ void JSModuleWriter::GenerateSource()
 
 
     source += "// Begin Classes\n";
     source += "// Begin Classes\n";
 
 
-    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();
+    Vector<SharedPtr<JSBClass>> classes = module_->GetClasses();
 
 
     for (unsigned i = 0; i < classes.Size(); i++)
     for (unsigned i = 0; i < classes.Size(); i++)
     {
     {

+ 1 - 1
Source/ToolCore/JSBind/JavaScript/JSPackageWriter.cpp

@@ -105,7 +105,7 @@ void JSPackageWriter::WriteProtoTypeSetup(String& source)
 {
 {
     Vector<JSBClass*> written;
     Vector<JSBClass*> written;
 
 
-    PODVector<JSBClass*>& allClasses = package_->GetAllClasses();
+    PODVector<JSBClass*> allClasses = package_->GetAllClasses();
 
 
     for (unsigned i = 0; i < allClasses.Size(); i++)
     for (unsigned i = 0; i < allClasses.Size(); i++)
     {
     {