diff --git a/src/Bytecode/Instruction/execute.c b/src/Bytecode/Instruction/execute.c index 5f4c25d..fc86f12 100644 --- a/src/Bytecode/Instruction/execute.c +++ b/src/Bytecode/Instruction/execute.c @@ -782,6 +782,7 @@ struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeIns for (GroundSize i = 0; i < function->args.count; i++) { if (function->args.at[i].as.type.type != HEAP_GET(heap, instruction->args.at[i+1])->type.type) { + printf("%d != %d\n", function->args.at[i].as.type.type, HEAP_GET(heap, instruction->args.at[i+1])->type.type); Ground.Log.Error("incorrect type of argument for native function in Ground.Bytecode.Instruction.execute"); Ground.Flags.error = true; return CONTINUE; @@ -979,15 +980,15 @@ struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeIns } for (size_t i = 0; i < argsSize; i++) { - enum GroundTypeType argTypeType = HEAP_GET(heap, instruction->args.at[i + 4])->as.CoreType; - switch (argTypeType) { + GroundBytecodeValue* argTypeVal = HEAP_GET(heap, instruction->args.at[i + 4]); + switch (argTypeVal->type.type) { case GroundType_Struct: { bf.args.at[i].as.type.type = GroundType_Object; // TODO implement structs break; } case GroundType_CoreType: { - bf.args.at[i].as.type.type = HEAP_GET(heap, instruction->args.at[i + 4])->as.CoreType; + bf.args.at[i].as.type.type = argTypeVal->as.CoreType; break; } default: { diff --git a/src/New/BytecodeValue.c b/src/New/BytecodeValue.c index 0b075c5..1bf4a31 100644 --- a/src/New/BytecodeValue.c +++ b/src/New/BytecodeValue.c @@ -96,6 +96,10 @@ GroundBytecodeValue _GroundNewBytecodeValue(GroundValue value) { // TODO - convert to bytecode object break; } + case GroundType_CoreType: { + bv.as.CoreType = value.as.CoreType; + break; + } } return bv;