|
|
@@ -656,7 +656,7 @@ void asCCompiler::CallDestructor(asCDataType &type, int offset, bool isObjectOnH
|
|
|
if( type.GetBehaviour()->destruct )
|
|
|
{
|
|
|
// Call the destructor as a regular function
|
|
|
- bc->InstrSHORT(asBC_PSF, offset);
|
|
|
+ bc->InstrSHORT(asBC_PSF, (short)offset);
|
|
|
asSExprContext ctx(engine);
|
|
|
PerformFunctionCall(type.GetBehaviour()->destruct, &ctx);
|
|
|
bc->AddCode(&ctx.bc);
|
|
|
@@ -1043,7 +1043,7 @@ void asCCompiler::FinalizeFunction()
|
|
|
outFunc->lineNumbers = byteCode.lineNumbers;
|
|
|
}
|
|
|
|
|
|
-void asCCompiler::PrepareArgument(asCDataType *paramType, asSExprContext *ctx, asCScriptNode *node, bool isFunction, int refType, asCArray<int> *reservedVars, bool forceOnHeap)
|
|
|
+void asCCompiler::PrepareArgument(asCDataType *paramType, asSExprContext *ctx, asCScriptNode *node, bool isFunction, int refType, asCArray<int> *reservedVars, bool /* forceOnHeap */)
|
|
|
{
|
|
|
asCDataType param = *paramType;
|
|
|
if( paramType->GetTokenType() == ttQuestion )
|
|
|
@@ -1480,8 +1480,12 @@ int asCCompiler::CompileDefaultArgs(asCScriptNode *node, asCArray<asSExprContext
|
|
|
|
|
|
// Compile the arguments in reverse order (as they will be pushed on the stack)
|
|
|
args.SetLength(func->parameterTypes.GetLength());
|
|
|
+ for( asUINT c = explicitArgs; c < args.GetLength(); c++ )
|
|
|
+ args[c] = 0;
|
|
|
for( int n = (int)func->parameterTypes.GetLength() - 1; n >= explicitArgs; n-- )
|
|
|
{
|
|
|
+ if( func->defaultArgs[n] == 0 ) { anyErrors = true; continue; }
|
|
|
+
|
|
|
// Parse the default arg string
|
|
|
asCParser parser(builder);
|
|
|
asCScriptCode code;
|
|
|
@@ -2021,29 +2025,7 @@ void asCCompiler::CompileInitList(asCTypeInfo *var, asCScriptNode *node, asCByte
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-#ifdef AS_DEPRECATED
|
|
|
- // Since 2.20.0
|
|
|
- if( funcId == 0 )
|
|
|
- {
|
|
|
- asSTypeBehaviour *beh = var->dataType.GetBehaviour();
|
|
|
- for( asUINT n = 0; n < beh->operators.GetLength(); n += 2 )
|
|
|
- {
|
|
|
- if( asBEHAVE_INDEX == beh->operators[n] )
|
|
|
- {
|
|
|
- asCScriptFunction *desc = builder->GetFunctionDescription(beh->operators[n+1]);
|
|
|
- if( !desc->isReadOnly &&
|
|
|
- desc->parameterTypes.GetLength() == 1 &&
|
|
|
- (desc->parameterTypes[0] == asCDataType::CreatePrimitive(ttUInt, false) ||
|
|
|
- desc->parameterTypes[0] == asCDataType::CreatePrimitive(ttInt, false)) &&
|
|
|
- desc->returnType == retType )
|
|
|
- {
|
|
|
- funcId = beh->operators[n+1];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-#endif
|
|
|
+
|
|
|
if( funcId == 0 )
|
|
|
{
|
|
|
Error(TXT_NO_APPROPRIATE_INDEX_OPERATOR, node);
|
|
|
@@ -3676,7 +3658,7 @@ void asCCompiler::PerformAssignment(asCTypeInfo *lvalue, asCTypeInfo *rvalue, as
|
|
|
}
|
|
|
|
|
|
// Copy larger data types from a reference
|
|
|
- bc->InstrSHORT_DW(asBC_COPY, lvalue->dataType.GetSizeInMemoryDWords(), engine->GetTypeIdFromDataType(lvalue->dataType));
|
|
|
+ bc->InstrSHORT_DW(asBC_COPY, (short)lvalue->dataType.GetSizeInMemoryDWords(), engine->GetTypeIdFromDataType(lvalue->dataType));
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -3808,7 +3790,7 @@ bool asCCompiler::CompileRefCast(asSExprContext *ctx, const asCDataType &to, boo
|
|
|
DeallocateVariable(offset);
|
|
|
#else
|
|
|
int offset = AllocateVariable(asCDataType::CreatePrimitive(ttUInt, false), true);
|
|
|
- ctx->bc.InstrW_DW(asBC_SetV4, offset, 0);
|
|
|
+ ctx->bc.InstrW_DW(asBC_SetV4, (asWORD)offset, 0);
|
|
|
ctx->bc.InstrW_W(asBC_CMPi, ctx->type.stackOffset, offset);
|
|
|
DeallocateVariable(offset);
|
|
|
#endif
|
|
|
@@ -4864,18 +4846,14 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
|
|
|
if( from->type.dataType.IsFloatType() )
|
|
|
{
|
|
|
float fc = from->type.floatValue;
|
|
|
- int uic = int(fc);
|
|
|
+ asUINT uic = asUINT(fc);
|
|
|
|
|
|
if( float(uic) != fc )
|
|
|
{
|
|
|
if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
|
|
|
}
|
|
|
- else if( uic < 0 )
|
|
|
- {
|
|
|
- if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_CHANGE_SIGN, node);
|
|
|
- }
|
|
|
|
|
|
- from->type.dataType = asCDataType::CreatePrimitive(ttInt, true);
|
|
|
+ from->type.dataType = asCDataType::CreatePrimitive(ttUInt, true);
|
|
|
from->type.intValue = uic;
|
|
|
|
|
|
// Try once more, in case of a smaller type
|
|
|
@@ -4884,14 +4862,14 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
|
|
|
else if( from->type.dataType.IsDoubleType() )
|
|
|
{
|
|
|
double fc = from->type.doubleValue;
|
|
|
- int uic = int(fc);
|
|
|
+ asUINT uic = asUINT(fc);
|
|
|
|
|
|
if( double(uic) != fc )
|
|
|
{
|
|
|
if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
|
|
|
}
|
|
|
|
|
|
- from->type.dataType = asCDataType::CreatePrimitive(ttInt, true);
|
|
|
+ from->type.dataType = asCDataType::CreatePrimitive(ttUInt, true);
|
|
|
from->type.intValue = uic;
|
|
|
|
|
|
// Try once more, in case of a smaller type
|
|
|
@@ -4967,11 +4945,13 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
|
|
|
// Convert first to int64 then to uint64 to avoid negative float becoming 0 on gnuc base compilers
|
|
|
asQWORD uic = asQWORD(asINT64(fc));
|
|
|
|
|
|
- // TODO: MSVC6 doesn't permit UINT64 to double
|
|
|
- if( float((signed)uic) != fc )
|
|
|
+#if !defined(_MSC_VER) || _MSC_VER > 1200 // MSVC++ 6
|
|
|
+ // MSVC6 doesn't support this conversion
|
|
|
+ if( float(uic) != fc )
|
|
|
{
|
|
|
if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
from->type.dataType = asCDataType::CreatePrimitive(ttUInt64, true);
|
|
|
from->type.qwordValue = uic;
|
|
|
@@ -4982,11 +4962,13 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
|
|
|
// Convert first to int64 then to uint64 to avoid negative float becoming 0 on gnuc base compilers
|
|
|
asQWORD uic = asQWORD(asINT64(fc));
|
|
|
|
|
|
- // TODO: MSVC6 doesn't permit UINT64 to double
|
|
|
- if( double((signed)uic) != fc )
|
|
|
+#if !defined(_MSC_VER) || _MSC_VER > 1200 // MSVC++ 6
|
|
|
+ // MSVC6 doesn't support this conversion
|
|
|
+ if( double(uic) != fc )
|
|
|
{
|
|
|
if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
from->type.dataType = asCDataType::CreatePrimitive(ttUInt64, true);
|
|
|
from->type.qwordValue = uic;
|
|
|
@@ -5119,7 +5101,6 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
|
|
|
}
|
|
|
else if( from->type.dataType.IsUnsignedType() && from->type.dataType.GetSizeInMemoryDWords() == 2 )
|
|
|
{
|
|
|
- // TODO: MSVC6 doesn't permit UINT64 to double
|
|
|
float fc = float((signed)from->type.qwordValue);
|
|
|
|
|
|
if( asQWORD(fc) != from->type.qwordValue )
|
|
|
@@ -5215,7 +5196,6 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
|
|
|
}
|
|
|
else if( from->type.dataType.IsUnsignedType() && from->type.dataType.GetSizeInMemoryDWords() == 2 )
|
|
|
{
|
|
|
- // TODO: MSVC6 doesn't permit UINT64 to double
|
|
|
double fc = double((signed)from->type.qwordValue);
|
|
|
|
|
|
if( asQWORD(fc) != from->type.qwordValue )
|
|
|
@@ -5920,7 +5900,7 @@ int asCCompiler::CompileVariableAccess(const asCString &name, const asCString &s
|
|
|
|
|
|
// TODO: This is the same as what is in CompileExpressionPostOp
|
|
|
// Put the offset on the stack
|
|
|
- ctx->bc.InstrSHORT_DW(asBC_ADDSi, prop->byteOffset, engine->GetTypeIdFromDataType(dt));
|
|
|
+ ctx->bc.InstrSHORT_DW(asBC_ADDSi, (short)prop->byteOffset, engine->GetTypeIdFromDataType(dt));
|
|
|
|
|
|
if( prop->type.IsReference() )
|
|
|
ctx->bc.Instr(asBC_RDSPTR);
|
|
|
@@ -6497,16 +6477,16 @@ asUINT asCCompiler::ProcessStringConstant(asCString &cstr, asCScriptNode *node,
|
|
|
// Hexadecimal escape sequences produce exact value, even if it is not proper unicode chars
|
|
|
if( engine->ep.stringEncoding == 0 )
|
|
|
{
|
|
|
- str.PushLast(val);
|
|
|
+ str.PushLast((asBYTE)val);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
#ifndef AS_BIG_ENDIAN
|
|
|
- str.PushLast(val);
|
|
|
- str.PushLast(val>>8);
|
|
|
+ str.PushLast((asBYTE)val);
|
|
|
+ str.PushLast((asBYTE)(val>>8));
|
|
|
#else
|
|
|
- str.PushLast(val>>8);
|
|
|
- str.PushLast(val);
|
|
|
+ str.PushLast((asBYTE)(val>>8));
|
|
|
+ str.PushLast((asBYTE)val);
|
|
|
#endif
|
|
|
}
|
|
|
if( charLiteral == -1 ) charLiteral = val;
|
|
|
@@ -6606,7 +6586,7 @@ asUINT asCCompiler::ProcessStringConstant(asCString &cstr, asCScriptNode *node,
|
|
|
else
|
|
|
{
|
|
|
// Do not convert ASCII characters
|
|
|
- encodedValue[0] = val;
|
|
|
+ encodedValue[0] = (asBYTE)val;
|
|
|
len = 1;
|
|
|
}
|
|
|
|
|
|
@@ -7659,7 +7639,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
|
|
|
{
|
|
|
asCScriptFunction *f = engine->scriptFunctions[ot->methods[n]];
|
|
|
// TODO: The type of the parameter should match the argument (unless the arg is a dummy)
|
|
|
- if( f->name == getName && f->parameterTypes.GetLength() == (arg?1:0) )
|
|
|
+ if( f->name == getName && (int)f->parameterTypes.GetLength() == (arg?1:0) )
|
|
|
{
|
|
|
if( getId == 0 )
|
|
|
getId = ot->methods[n];
|
|
|
@@ -7672,7 +7652,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
|
|
|
}
|
|
|
}
|
|
|
// TODO: getset: If the parameter is a reference, it must not be an out reference. Should we allow inout ref?
|
|
|
- if( f->name == setName && f->parameterTypes.GetLength() == (arg?2:1) )
|
|
|
+ if( f->name == setName && (int)f->parameterTypes.GetLength() == (arg?2:1) )
|
|
|
{
|
|
|
if( setId == 0 )
|
|
|
setId = ot->methods[n];
|
|
|
@@ -7696,7 +7676,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
|
|
|
{
|
|
|
asCScriptFunction *f = engine->scriptFunctions[funcs[n]];
|
|
|
// TODO: The type of the parameter should match the argument (unless the arg is a dummy)
|
|
|
- if( f->parameterTypes.GetLength() == (arg?1:0) )
|
|
|
+ if( (int)f->parameterTypes.GetLength() == (arg?1:0) )
|
|
|
{
|
|
|
if( getId == 0 )
|
|
|
getId = funcs[n];
|
|
|
@@ -7716,7 +7696,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
|
|
|
{
|
|
|
asCScriptFunction *f = engine->scriptFunctions[funcs[n]];
|
|
|
// TODO: getset: If the parameter is a reference, it must not be an out reference. Should we allow inout ref?
|
|
|
- if( f->parameterTypes.GetLength() == (arg?2:1) )
|
|
|
+ if( (int)f->parameterTypes.GetLength() == (arg?2:1) )
|
|
|
{
|
|
|
if( setId == 0 )
|
|
|
setId = funcs[n];
|
|
|
@@ -7851,7 +7831,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
|
|
|
int offset = ctx->type.stackOffset;
|
|
|
bool isTemp = ctx->type.isTemporary;
|
|
|
ctx->type.Set(dt);
|
|
|
- ctx->type.stackOffset = offset;
|
|
|
+ ctx->type.stackOffset = (short)offset;
|
|
|
ctx->type.isTemporary = isTemp;
|
|
|
ctx->exprNode = node;
|
|
|
|
|
|
@@ -8241,7 +8221,7 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
|
|
|
}
|
|
|
|
|
|
// Put the offset on the stack
|
|
|
- ctx->bc.InstrSHORT_DW(asBC_ADDSi, prop->byteOffset, engine->GetTypeIdFromDataType(asCDataType::CreateObject(ctx->type.dataType.GetObjectType(), false)));
|
|
|
+ ctx->bc.InstrSHORT_DW(asBC_ADDSi, (short)prop->byteOffset, engine->GetTypeIdFromDataType(asCDataType::CreateObject(ctx->type.dataType.GetObjectType(), false)));
|
|
|
|
|
|
if( prop->type.IsReference() )
|
|
|
ctx->bc.Instr(asBC_RDSPTR);
|
|
|
@@ -8336,7 +8316,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
|
|
|
else if( op == ttOpenBracket )
|
|
|
{
|
|
|
// If the property access takes an index arg, then we should use that instead of processing it now
|
|
|
- // Urho3D: fix possible null pointer access
|
|
|
asCString propertyName;
|
|
|
if( (ctx->property_get && engine->scriptFunctions[ctx->property_get]->GetParamCount() == 1) ||
|
|
|
(ctx->property_set && engine->scriptFunctions[ctx->property_set]->GetParamCount() == 2) )
|
|
|
@@ -8378,10 +8357,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
|
|
|
}
|
|
|
|
|
|
Dereference(ctx, true);
|
|
|
-#ifdef AS_DEPRECATED
|
|
|
- // Since 2.20.0
|
|
|
- bool isConst = ctx->type.dataType.IsReadOnly();
|
|
|
-#endif
|
|
|
|
|
|
// Compile the expression
|
|
|
asSExprContext expr(engine);
|
|
|
@@ -8395,7 +8370,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
|
|
|
r = CompileOverloadedDualOperator2(node, "opIndex", &lctx, &expr, ctx);
|
|
|
if( r == 0 )
|
|
|
{
|
|
|
-#ifndef AS_DEPRECATED
|
|
|
// Check for accessors methods for the opIndex
|
|
|
r = FindPropertyAccessor(propertyName == "" ? "opIndex" : propertyName.AddressOf(), &lctx, &expr, node);
|
|
|
if( r == 0 )
|
|
|
@@ -8409,130 +8383,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
|
|
|
return -1;
|
|
|
|
|
|
MergeExprBytecodeAndType(ctx, &lctx);
|
|
|
-#else
|
|
|
- // Deprecated since 2.20.0
|
|
|
-
|
|
|
- MergeExprBytecodeAndType(ctx, &lctx);
|
|
|
-
|
|
|
- if( ctx->type.dataType.IsObjectHandle() )
|
|
|
- {
|
|
|
- // Convert the handle to a normal object
|
|
|
- asCDataType dt = ctx->type.dataType;
|
|
|
- dt.MakeHandle(false);
|
|
|
-
|
|
|
- ImplicitConversion(ctx, dt, node, asIC_IMPLICIT_CONV);
|
|
|
- }
|
|
|
-
|
|
|
- asCTypeInfo objType = ctx->type;
|
|
|
- asSTypeBehaviour *beh = ctx->type.dataType.GetBehaviour();
|
|
|
- if( beh == 0 )
|
|
|
- {
|
|
|
- asCString str;
|
|
|
- str.Format(TXT_OBJECT_DOESNT_SUPPORT_INDEX_OP, ctx->type.dataType.Format().AddressOf());
|
|
|
- Error(str.AddressOf(), node);
|
|
|
- return -1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Now find a matching function for the object type and indexing type
|
|
|
- asCArray<int> ops;
|
|
|
- asUINT n;
|
|
|
- if( isConst )
|
|
|
- {
|
|
|
- // Only list const behaviours
|
|
|
- for( n = 0; n < beh->operators.GetLength(); n += 2 )
|
|
|
- {
|
|
|
- if( asBEHAVE_INDEX == beh->operators[n] && engine->scriptFunctions[beh->operators[n+1]]->isReadOnly )
|
|
|
- ops.PushLast(beh->operators[n+1]);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // TODO: Prefer non-const over const
|
|
|
- for( n = 0; n < beh->operators.GetLength(); n += 2 )
|
|
|
- {
|
|
|
- if( asBEHAVE_INDEX == beh->operators[n] )
|
|
|
- ops.PushLast(beh->operators[n+1]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- asCArray<int> ops1;
|
|
|
- MatchArgument(ops, ops1, &expr.type, 0);
|
|
|
-
|
|
|
- if( !isConst )
|
|
|
- FilterConst(ops1);
|
|
|
-
|
|
|
- // Did we find a suitable function?
|
|
|
- if( ops1.GetLength() == 1 )
|
|
|
- {
|
|
|
- asCScriptFunction *descr = engine->scriptFunctions[ops1[0]];
|
|
|
-
|
|
|
- // Store the code for the object
|
|
|
- asCByteCode objBC(engine);
|
|
|
- objBC.AddCode(&ctx->bc);
|
|
|
-
|
|
|
- // Add code for arguments
|
|
|
-
|
|
|
- PrepareArgument(&descr->parameterTypes[0], &expr, node->firstChild, true, descr->inOutFlags[0]);
|
|
|
- MergeExprBytecode(ctx, &expr);
|
|
|
-
|
|
|
- if( descr->parameterTypes[0].IsReference() )
|
|
|
- {
|
|
|
- if( descr->parameterTypes[0].IsObject() && !descr->parameterTypes[0].IsObjectHandle() )
|
|
|
- ctx->bc.InstrWORD(asBC_GETOBJREF, 0);
|
|
|
- else
|
|
|
- ctx->bc.InstrWORD(asBC_GETREF, 0);
|
|
|
- }
|
|
|
- else if( descr->parameterTypes[0].IsObject() )
|
|
|
- {
|
|
|
- ctx->bc.InstrWORD(asBC_GETOBJ, 0);
|
|
|
-
|
|
|
- // The temporary variable must not be freed as it will no longer hold an object
|
|
|
- DeallocateVariable(expr.type.stackOffset);
|
|
|
- expr.type.isTemporary = false;
|
|
|
- }
|
|
|
-
|
|
|
- // Add the code for the object again
|
|
|
- ctx->bc.AddCode(&objBC);
|
|
|
-
|
|
|
- asCArray<asSExprContext*> args;
|
|
|
- args.PushLast(&expr);
|
|
|
- PerformFunctionCall(descr->id, ctx, false, &args);
|
|
|
- }
|
|
|
- else if( ops.GetLength() > 1 )
|
|
|
- {
|
|
|
- Error(TXT_MORE_THAN_ONE_MATCHING_OP, node);
|
|
|
- PrintMatchingFuncs(ops, node);
|
|
|
-
|
|
|
- return -1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- asCString str;
|
|
|
- str.Format(TXT_NO_MATCHING_OP_FOUND_FOR_TYPE_s, expr.type.dataType.Format().AddressOf());
|
|
|
- Error(str.AddressOf(), node);
|
|
|
- return -1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // If the method returned a reference, then we can't release the original
|
|
|
- // object yet, because the reference may be to a member of it
|
|
|
- if( objType.isTemporary &&
|
|
|
- (ctx->type.dataType.IsReference() || (ctx->type.dataType.IsObject() && !ctx->type.dataType.IsObjectHandle())) &&
|
|
|
- !ctx->type.isVariable ) // If the resulting type is a variable, then the reference is not to a member
|
|
|
- {
|
|
|
- // Remember the object's variable, so that it can be released
|
|
|
- // later on when the reference to its member goes out of scope
|
|
|
- ctx->type.isTemporary = true;
|
|
|
- ctx->type.stackOffset = objType.stackOffset;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // As the index operator didn't return a reference to a
|
|
|
- // member we can release the original object now
|
|
|
- ReleaseTemporaryVariable(objType, &ctx->bc);
|
|
|
- }
|
|
|
-#endif
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -9024,7 +8874,7 @@ int asCCompiler::CompileOverloadedDualOperator2(asCScriptNode *node, const char
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-void asCCompiler::MakeFunctionCall(asSExprContext *ctx, int funcId, asCObjectType *objectType, asCArray<asSExprContext*> &args, asCScriptNode *node, bool useVariable, int stackOffset, int funcPtrVar)
|
|
|
+void asCCompiler::MakeFunctionCall(asSExprContext *ctx, int funcId, asCObjectType *objectType, asCArray<asSExprContext*> &args, asCScriptNode * /*node*/, bool useVariable, int stackOffset, int funcPtrVar)
|
|
|
{
|
|
|
if( objectType )
|
|
|
{
|
|
|
@@ -10521,7 +10371,7 @@ void asCCompiler::PerformFunctionCall(int funcId, asSExprContext *ctx, bool isCo
|
|
|
// In order to guarantee the lifetime of the reference, we must hold a local reference to the object.
|
|
|
// TODO: optimize: This can be avoided for local variables (non-handles) as they have a well defined life time
|
|
|
int tempRef = AllocateVariable(ctx->type.dataType, true);
|
|
|
- ctx->bc.InstrSHORT(asBC_PSF, tempRef);
|
|
|
+ ctx->bc.InstrSHORT(asBC_PSF, (short)tempRef);
|
|
|
ctx->bc.InstrPTR(asBC_REFCPY, ctx->type.dataType.GetObjectType());
|
|
|
|
|
|
// Add the release of this reference, as a deferred expression
|