if(c->type == 2 || c->type == 3 || c->type == 4 || c->type == 1000)
return 0;
+else if(c->type == 1 && !this->byReference)
+return 0;
}
return 1;
}
if(tempType->__anon1._class)
MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 1, 1, 0, 0, warnConst);
backupSourceExpType = sourceExp->expType;
+if(dest->passAsTemplate)
+{
+sourceExp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
+CopyTypeInto(sourceExp->expType, dest);
+sourceExp->expType->passAsTemplate = 0;
+}
+else
+{
sourceExp->expType = dest;
dest->refCount++;
+}
flag = 1;
((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
}
{
struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
struct Context * context;
+int kind = exp->expType->kind;
*newExp = *exp;
if(exp->destType)
exp->expType->refCount++;
newExp->prev = (((void *)0));
newExp->next = (((void *)0));
-switch(exp->expType->kind)
+if(exp->expType->kind == 8 && exp->expType->__anon1._class && exp->expType->__anon1._class->__anon1.registered)
+{
+struct __ecereNameSpace__ecere__com__Class * c = exp->expType->__anon1._class->__anon1.registered;
+
+if(c->type == 2 || c->type == 4 || c->type == 3)
+{
+if(!c->dataType)
+c->dataType = ProcessTypeString(c->dataTypeString, 0);
+kind = c->dataType->kind;
+}
+}
+switch(kind)
{
case 7:
if(exp->destType->classObjectType)
default:
exp->type = 11;
exp->__anon1.cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
-if(__ecereProp_Type_Get_isPointerType(exp->expType))
+if((exp->expType->kind == 8 && exp->expType->__anon1._class && exp->expType->__anon1._class->__anon1.registered && exp->expType->__anon1._class->__anon1.registered->type == 1) || __ecereProp_Type_Get_isPointerType(exp->expType))
exp->__anon1.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), MkExpBrackets(MkListOne(newExp)));
else
exp->__anon1.cast.exp = MkExpBrackets(MkListOne(newExp));
{
struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
struct Context * context;
+int kind = exp->expType->kind;
*newExp = *exp;
if(exp->destType)
exp->expType->refCount++;
newExp->prev = (((void *)0));
newExp->next = (((void *)0));
-switch(exp->expType->kind)
+if(exp->expType->kind == 8 && exp->expType->__anon1._class && exp->expType->__anon1._class->__anon1.registered)
+{
+struct __ecereNameSpace__ecere__com__Class * c = exp->expType->__anon1._class->__anon1.registered;
+
+if(c->type == 2 || c->type == 4 || c->type == 3)
+{
+if(!c->dataType)
+c->dataType = ProcessTypeString(c->dataTypeString, 0);
+kind = c->dataType->kind;
+}
+}
+switch(kind)
{
case 7:
if(exp->destType->classObjectType)
if(exp->expType->__anon1._class && exp->expType->__anon1._class->__anon1.registered && exp->expType->__anon1._class->__anon1.registered->type == 1)
{
exp->type = 5;
-if(__ecereProp_Type_Get_isPointerType(exp->expType))
newExp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), newExp);
exp->__anon1.list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->__anon1._class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
ProcessExpressionType((*exp->__anon1.list).first);
case 8:
{
struct Symbol * c = type->__anon1._class;
+unsigned int isObjectBaseClass = !c || !c->string || !strcmp(c->string, "class");
-if(type->classObjectType == 2)
+if(type->classObjectType == 2 && isObjectBaseClass)
strcat(string, "typed_object");
-else if(type->classObjectType == 3)
+else if(type->classObjectType == 3 && isObjectBaseClass)
strcat(string, "any_object");
else
{
__ecereMethod_Expression_Clear(e);
if((type->kind == 8 && type->__anon1._class && type->__anon1._class->__anon1.registered && (type->__anon1._class->__anon1.registered->type == 1000 || type->__anon1._class->__anon1.registered->type == 2 || type->__anon1._class->__anon1.registered->type == 4 || type->__anon1._class->__anon1.registered->type == 3)) || (type->kind != 13 && type->kind != 22 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
{
+unsigned int passAsTemplate = thisExp->destType->passAsTemplate;
+struct Type * t;
+
+destType->refCount++;
e->type = 4;
e->__anon1.op.op = '*';
e->__anon1.op.exp1 = (((void *)0));
e->__anon1.op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
+t = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
+CopyTypeInto(t, thisExp->destType);
+t->passAsTemplate = 0;
+FreeType(thisExp->destType);
+thisExp->destType = t;
+t = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
+CopyTypeInto(t, destType);
+t->passAsTemplate = passAsTemplate;
+FreeType(destType);
+destType = t;
+destType->refCount = 0;
e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
CopyTypeInto(e->expType, type);
+if(type->passAsTemplate)
+{
+e->expType->classObjectType = 0;
+e->expType->passAsTemplate = 0;
+}
e->expType->byReference = 0;
e->expType->refCount = 1;
}
e->expType = type;
type->refCount++;
}
+if(e->destType)
+FreeType(e->destType);
e->destType = destType;
destType->refCount++;
}
else if(checkedExp->type == 11)
checkedExp = checkedExp->__anon1.cast.exp;
}
-newExp = MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpOp((((void *)0)), '&', checkedExp));
+{
+struct Expression * i;
+
+newExp = MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), (i = MkExpOp((((void *)0)), '&', checkedExp)));
+i->byReference = 1;
newExp->byReference = 1;
+}
if(parentExp->type == 7)
{
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), e->prev, newExp);
struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
char typeString[1024];
unsigned int castingToDest = 0;
-unsigned int pointerCastExp;
+unsigned int pointerCastExp = 0;
typeString[0] = '\0';
e->needTemplateCast = 2;
{
struct Specifier * spec = specs ? (*specs).first : (((void *)0));
struct TemplateParameter * tp = (spec && spec->type == 8) ? spec->__anon1.templateParameter : (((void *)0));
+struct Type * type = castingToDest ? exp->destType : exp->expType;
+unsigned int specsDeclPointer = (spec->type == 1 && strcmp(spec->__anon1.__anon1.name, "uint64")) || (decl && decl->type == 5) || (tp && tp->__anon1.dataType && ((tp->__anon1.dataType->decl && tp->__anon1.dataType->decl->type == 5) || (tp->__anon1.dataType->specifiers && ((struct Specifier *)(*tp->__anon1.dataType->specifiers).first)->type == 1 && strcmp(((struct Specifier *)(*tp->__anon1.dataType->specifiers).first)->__anon1.__anon1.name, "uint64"))));
-pointerCastExp = (spec->type == 1 && strcmp(spec->__anon1.__anon1.name, "uint64")) || (decl && decl->type == 5) || (tp && tp->__anon1.dataType && ((tp->__anon1.dataType->decl && tp->__anon1.dataType->decl->type == 5) || (tp->__anon1.dataType->specifiers && ((struct Specifier *)(*tp->__anon1.dataType->specifiers).first)->type == 1 && strcmp(((struct Specifier *)(*tp->__anon1.dataType->specifiers).first)->__anon1.__anon1.name, "uint64")))) || (castingToDest ? __ecereProp_Type_Get_isPointerType(exp->destType) : __ecereProp_Type_Get_isPointerType(exp->expType));
+pointerCastExp = type ? ((type->kind == 20 && specsDeclPointer) || __ecereProp_Type_Get_isPointerType(type)) : specsDeclPointer;
}
if(pointerCastExp)
{
Class c = _class.registered;
if(c.type == bitClass || c.type == unitClass || c.type == enumClass || c.type == systemClass)
return false;
+ else if(c.type == structClass && !byReference)
+ return false;
}
return true;
}
// NOTE: To handle bad warnings on int64 vs 32 bit eda::Id incompatibilities
backupSourceExpType = sourceExp.expType;
- sourceExp.expType = dest; dest.refCount++;
+ if(dest.passAsTemplate)
+ {
+ // Don't carry passAsTemplate
+ sourceExp.expType = { };
+ CopyTypeInto(sourceExp.expType, dest);
+ sourceExp.expType.passAsTemplate = false;
+ }
+ else
+ {
+ sourceExp.expType = dest;
+ dest.refCount++;
+ }
//sourceExp.expType = MkClassType(_class.fullName);
flag = true;
void CheckTemplateTypes(Expression exp)
{
+ /*
+ bool et = exp.expType ? exp.expType.passAsTemplate : false;
+ bool dt = exp.destType ? exp.destType.passAsTemplate : false;
+ */
Expression nbExp = GetNonBracketsExp(exp);
if(exp.destType && exp.destType.passAsTemplate && exp.expType && exp.expType.kind != templateType && !exp.expType.passAsTemplate &&
(nbExp == exp || nbExp.type != castExp))
{
Expression newExp { };
Context context;
+ TypeKind kind = exp.expType.kind;
*newExp = *exp;
if(exp.destType) exp.destType.refCount++;
if(exp.expType) exp.expType.refCount++;
newExp.prev = null;
newExp.next = null;
- switch(exp.expType.kind)
+ if(exp.expType.kind == classType && exp.expType._class && exp.expType._class.registered)
+ {
+ Class c = exp.expType._class.registered;
+ if(c.type == bitClass || c.type == enumClass || c.type == unitClass)
+ {
+ if(!c.dataType)
+ c.dataType = ProcessTypeString(c.dataTypeString, false);
+ kind = c.dataType.kind;
+ }
+ }
+
+ switch(kind)
{
case doubleType:
if(exp.destType.classObjectType)
default:
exp.type = castExp;
exp.cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), null);
- if(exp.expType.isPointerType)
+ if((exp.expType.kind == classType && exp.expType._class && exp.expType._class.registered && exp.expType._class.registered.type == structClass) || exp.expType.isPointerType)
exp.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), null), MkExpBrackets(MkListOne(newExp)));
else
exp.cast.exp = MkExpBrackets(MkListOne(newExp));
{
Expression newExp { };
Context context;
+ TypeKind kind = exp.expType.kind;
*newExp = *exp;
if(exp.destType) exp.destType.refCount++;
if(exp.expType) exp.expType.refCount++;
newExp.prev = null;
newExp.next = null;
- switch(exp.expType.kind)
+ if(exp.expType.kind == classType && exp.expType._class && exp.expType._class.registered)
+ {
+ Class c = exp.expType._class.registered;
+ if(c.type == bitClass || c.type == enumClass || c.type == unitClass)
+ {
+ if(!c.dataType)
+ c.dataType = ProcessTypeString(c.dataTypeString, false);
+ kind = c.dataType.kind;
+ }
+ }
+
+ switch(kind)
{
case doubleType:
if(exp.destType.classObjectType)
{
exp.type = bracketsExp;
- if(exp.expType.isPointerType)
- newExp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), null), newExp);
+ newExp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), null), newExp);
exp.list = MkListOne(MkExpOp(null, '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp.expType._class.string)),
MkDeclaratorPointer(MkPointer(null, null), null)), newExp)));
ProcessExpressionType(exp.list->first);
case classType:
{
Symbol c = type._class;
+ bool isObjectBaseClass = !c || !c.string || !strcmp(c.string, "class");
// TODO: typed_object does not fully qualify the type, as it may have taken up an actual class (Stored in _class) from overriding
// look into merging with thisclass ?
- if(type.classObjectType == typedObject)
+ if(type.classObjectType == typedObject && isObjectBaseClass)
strcat(string, "typed_object");
- else if(type.classObjectType == anyObject)
+ else if(type.classObjectType == anyObject && isObjectBaseClass)
strcat(string, "any_object");
else
{
(type.kind != pointerType && type.kind != intPtrType && type.kind != arrayType && type.kind != classType) ||
(!destType.byReference && byReference && (destType.kind != pointerType || type.kind != pointerType)))
{
+ bool passAsTemplate = thisExp.destType.passAsTemplate;
+ Type t;
+
+ destType.refCount++;
+
e.type = opExp;
e.op.op = '*';
e.op.exp1 = null;
e.op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer(null, null), decl)), thisExp);
+ t = { };
+ CopyTypeInto(t, thisExp.destType);
+ t.passAsTemplate = false;
+ FreeType(thisExp.destType);
+ thisExp.destType = t;
+
+ t = { };
+ CopyTypeInto(t, destType);
+ t.passAsTemplate = passAsTemplate;
+ FreeType(destType);
+ destType = t;
+ destType.refCount = 0;
+
e.expType = { };
CopyTypeInto(e.expType, type);
+ if(type.passAsTemplate)
+ {
+ e.expType.classObjectType = none;
+ e.expType.passAsTemplate = false;
+ }
e.expType.byReference = false;
e.expType.refCount = 1;
}
e.expType = type;
type.refCount++;
}
+
+ if(e.destType)
+ FreeType(e.destType);
+
e.destType = destType;
destType.refCount++;
}
else if(checkedExp.type == castExp)
checkedExp = checkedExp.cast.exp;
}
- newExp = MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, null), null)), MkExpOp(null, '&', checkedExp));
- newExp.byReference = true;
+ {
+ Expression i;
+ newExp = MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, null), null)), (i = MkExpOp(null, '&', checkedExp)));
+ i.byReference = true;
+ newExp.byReference = true;
+ }
if(parentExp.type == callExp)
{
exp.call.arguments->Insert(e.prev, newExp);
OldList * specs = MkList();
char typeString[1024];
bool castingToDest = false;
- bool pointerCastExp;
+ bool pointerCastExp = false;
typeString[0] = '\0';
{
Specifier spec = specs ? specs->first : null;
TemplateParameter tp = (spec && spec.type == templateTypeSpecifier) ? spec.templateParameter : null;
- pointerCastExp =
- (spec.type == nameSpecifier && strcmp(spec.name, "uint64")) ||
+ Type type = castingToDest ? exp.destType : exp.expType;
+ bool specsDeclPointer = (spec.type == nameSpecifier && strcmp(spec.name, "uint64")) ||
(decl && decl.type == pointerDeclarator) ||
(tp && tp.dataType &&
( (tp.dataType.decl && tp.dataType.decl.type == pointerDeclarator) ||
- (tp.dataType.specifiers && ((Specifier)tp.dataType.specifiers->first).type == nameSpecifier && strcmp(((Specifier)tp.dataType.specifiers->first).name, "uint64")) ) ) ||
- (castingToDest ? exp.destType.isPointerType : exp.expType.isPointerType);
+ (tp.dataType.specifiers && ((Specifier)tp.dataType.specifiers->first).type == nameSpecifier && strcmp(((Specifier)tp.dataType.specifiers->first).name, "uint64")) ) );
+ pointerCastExp = type ? ((type.kind == templateType && specsDeclPointer) || type.isPointerType) : specsDeclPointer;
}
if(pointerCastExp)