compiler/libec: Fixed warnings on class_data and (sub)class properties
authorJerome St-Louis <jerome@ecere.com>
Sun, 8 Jun 2014 02:05:19 +0000 (22:05 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sun, 8 Jun 2014 02:05:19 +0000 (22:05 -0400)
compiler/bootstrap/libec/bootstrap/pass0.c
compiler/bootstrap/libec/bootstrap/pass2.c
compiler/libec/src/pass0.ec
compiler/libec/src/pass2.ec

index 1c17013..7420dd1 100644 (file)
@@ -2372,12 +2372,12 @@ func->dontMangle = 0x1;
 newDef = MkClassDefFunction(func);
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
 after = newDef;
-decl = MkDeclaratorFunction(propertyDef->declarator, (((void *)0)));
+decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction((((void *)0)), (((void *)0))));
 func->type = ProcessType(propertyDef->specifiers, decl);
-decl->declarator = (((void *)0));
 FreeDeclarator(decl);
 if(func->type->__anon1.__anon2.returnType->kind == 8 && func->type->__anon1.__anon2.returnType->__anon1._class && func->type->__anon1.__anon2.returnType->__anon1._class->__anon1.registered && func->type->__anon1.__anon2.returnType->__anon1._class->__anon1.registered->type == 1)
 func->type->__anon1.__anon2.returnType->byReference = 0x1;
+func->type->__anon1.__anon2.returnType->passAsTemplate = 0x1;
 if(inCompiler)
 propertyDef->getStmt = (((void *)0));
 else
index a95d93e..4cce8b3 100644 (file)
@@ -1538,6 +1538,8 @@ extern int printf(const char * , ...);
 
 extern struct Type * ProcessTemplateParameterType(struct TemplateParameter * param);
 
+extern void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
+
 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, const void * object, ...);
 
 extern void DeclareStruct(const char *  name, unsigned int skipNoHead);
@@ -1554,8 +1556,6 @@ static void ProcessInitializer(struct Initializer * init);
 
 extern struct Expression * CopyExpContents(struct Expression * exp);
 
-extern void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
-
 extern struct Specifier * CopySpecifier(struct Specifier * spec);
 
 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
@@ -3453,15 +3453,28 @@ if(classProperty->Get)
 {
 struct Identifier * id = exp->__anon1.member.member;
 struct Expression * classExp = exp->__anon1.member.exp;
+struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
 
-exp->type = 7;
-exp->__anon1.call.exp = MkExpIdentifier(MkIdentifier("ecere::com::eClass_GetProperty"));
-exp->__anon1.call.arguments = MkList();
-ListAdd(exp->__anon1.call.arguments, classExp);
+exp->type = 11;
+if(exp->expType)
+{
+char typeString[2048];
+struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
+struct Declarator * decl;
+
+typeString[0] = (char)0;
+PrintType(exp->expType, typeString, 0x0, 0x0);
+decl = SpecDeclFromString(typeString, specs, (((void *)0)));
+exp->__anon1.cast.typeName = MkTypeName(specs, decl);
+}
+else
+exp->__anon1.cast.typeName = QMkType("uint64", (((void *)0)));
+exp->__anon1.cast.exp = MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eClass_GetProperty")), args);
+ListAdd(args, classExp);
 {
 char * s = QMkString(id->string);
 
-ListAdd(exp->__anon1.call.arguments, MkExpString(s));
+ListAdd(args, MkExpString(s));
 (__ecereNameSpace__ecere__com__eSystem_Delete(s), s = 0);
 }
 FreeIdentifier(id);
index 161a3b6..f00cdf0 100644 (file)
@@ -1432,14 +1432,16 @@ static void ProcessClass(ClassType classType, OldList definitions, Symbol symbol
                      definitions.Insert(after, newDef);
                      after = newDef;
 
-                     decl = MkDeclaratorFunction(propertyDef.declarator, null);
+                     decl = PlugDeclarator(propertyDef.declarator, MkDeclaratorFunction(null , null));
                      func.type = ProcessType(propertyDef.specifiers, decl);
-                     decl.declarator = null;
                      FreeDeclarator(decl);
 
                      if(func.type.returnType.kind == TypeKind::classType && func.type.returnType._class && func.type.returnType._class.registered && func.type.returnType._class.registered.type == structClass)
                         func.type.returnType.byReference = true;
 
+                     // Leverage the fact that templated types are also boxed in a 64 bit integer
+                     func.type.returnType.passAsTemplate = true;
+
                      if(inCompiler)
                         propertyDef.getStmt = null;
                      else
index 6141d30..d1f5cd7 100644 (file)
@@ -2643,15 +2643,28 @@ static void ProcessExpression(Expression exp)
                   {
                      Identifier id = exp.member.member;
                      Expression classExp = exp.member.exp;
+                     OldList * args = MkList();
 
+                     exp.type = castExp;
                      // Class Property
-                     exp.type = callExp;
-                     exp.call.exp = MkExpIdentifier(MkIdentifier("ecere::com::eClass_GetProperty"));
-                     exp.call.arguments = MkList();
-                     ListAdd(exp.call.arguments, classExp);
+                     if(exp.expType)
+                     {
+                        char typeString[2048];
+                        OldList * specs = MkList();
+                        Declarator decl;
+                        typeString[0] = 0;
+                        PrintType(exp.expType, typeString, false, false);
+                        decl = SpecDeclFromString(typeString, specs, null);
+                        exp.cast.typeName = MkTypeName(specs, decl);
+                     }
+                     else
+                        exp.cast.typeName = QMkType("uint64", null);
+                     exp.cast.exp = MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eClass_GetProperty")), args);
+
+                     ListAdd(args, classExp);
                      {
                         char * s = QMkString(id.string);
-                        ListAdd(exp.call.arguments, MkExpString(s));
+                        ListAdd(args, MkExpString(s));
                         delete s;
                      }
                      FreeIdentifier(id);