void ApplyAnyObjectLogic(Expression e)
{
+ char debugExpString[4096];
Type destType = /*(e.destType && e.destType.kind == ellipsisType) ? ellipsisDestType : */e.destType;
+ debugExpString[0] = '\0';
+ PrintExpression(e, debugExpString);
+
if(destType && (/*destType.classObjectType == ClassObjectType::typedObject || */destType.classObjectType == anyObject))
{
//if(e.destType && e.destType.kind == ellipsisType) usedEllipsis = true;
e.op.op = '*';
e.op.exp1 = null;
e.op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer(null, null), decl)), thisExp);
+
+ /*e.expType = { };
+ CopyTypeInto(e.expType, type);
+ e.expType.byReference = false;
+ e.expType.refCount = 1;*/
}
else
{
e.cast.typeName = MkTypeName(specs, decl);
e.cast.exp = thisExp;
e.byReference = true;
+ /*e.expType = type;
+ type.refCount++;*/
}
- e.expType = type;
e.destType = destType;
- type.refCount++;
destType.refCount++;
+ e.expType = type;
+ type.refCount++;
}
}
}
if(type && type.kind != ellipsisType)
{
Type next = type.next;
+ // Allow manually passing a class for typed object
+ /*
+ if(type.kind == classType && type.classObjectType == typedObject && e && !e.prev)
+ {
+ ProcessExpressionType(e);
+ if(e.expType && (e.expType.kind == subClassType || (e.expType.kind == classType && e.expType._class && e.expType._class.registered &&
+ eClass_IsDerived(e.expType._class.registered, eSystem_FindClass(privateModule, "ecere::com::Class")))))
+ next = type;
+ }*/
if(!type.refCount) FreeType(type);
type = next;
}
{
Type type;
Location oldyylloc = yylloc;
- bool thisPtr = (exp.member.exp && exp.member.exp.type == identifierExp && !strcmp(exp.member.exp.identifier.string, "this"));
+ bool thisPtr = (exp.member.exp && exp.member.exp.type == identifierExp && !strcmp(exp.member.exp.identifier.string, "this");
+ Expression checkExp = exp.member.exp;
+ /*while(checkExp)
+ {
+ if(checkExp.type == castExp)
+ checkExp = checkExp.cast.exp;
+ else if(checkExp.type == bracketsExp)
+ checkExp = checkExp.list ? checkExp.list->first : null;
+ else
+ break;
+ }
+
+ thisPtr = (checkExp && checkExp.type == identifierExp && !strcmp(checkExp.identifier.string, "this"));*/
exp.thisPtr = thisPtr;
// DOING THIS LATER NOW...
{
thisSymbol.type.classObjectType = ClassObjectType::typedObject;
thisSymbol.type.byReference = type.byReference;
+ thisSymbol.type.typedByReference = type.byReference;
/*
thisSymbol = Symbol { string = CopyString("class") };
function.body.compound.context.symbols.Add(thisSymbol);
else
{
// If it's a this pointer, replace by precomputed shortcut
+ //if(thisPtr && (!exp.member.exp.expType || !exp.member.exp.expType.typedByReference))
if(thisPtr)
{
char pointerName[1024];
strcpy(pointerName, "__ecerePointer_");
FullClassNameCat(pointerName, type._class.registered.fullName, false);
- FreeIdentifier(exp.member.exp.identifier);
+ if(exp.member.exp.identifier)
+ FreeIdentifier(exp.member.exp.identifier);
exp.member.exp.identifier = MkIdentifier(pointerName);
}
// Otherwise, access the data the hard way