Snipped some duplicate code, resolved #97

This commit is contained in:
2023-08-04 14:52:01 +10:00
parent 604604e8bc
commit 64944c24f6

View File

@@ -1991,27 +1991,9 @@ static void readInterpreterSections(Toy_Interpreter* interpreter) {
} }
break; break;
case TOY_LITERAL_TYPE: { case TOY_LITERAL_TYPE:
//what the literal is case TOY_LITERAL_TYPE_INTERMEDIATE:
Toy_LiteralType literalType = (Toy_LiteralType)readByte(interpreter->bytecode, &interpreter->count); {
unsigned char constant = readByte(interpreter->bytecode, &interpreter->count);
Toy_Literal typeLiteral = TOY_TO_TYPE_LITERAL(literalType, constant);
//save the type
Toy_pushLiteralArray(&interpreter->literalCache, typeLiteral);
#ifndef TOY_EXPORT
if (Toy_commandLine.verbose) {
printf("(type ");
Toy_printLiteral(typeLiteral);
printf(")\n");
}
#endif
}
break;
case TOY_LITERAL_TYPE_INTERMEDIATE: {
//what the literal represents //what the literal represents
Toy_LiteralType literalType = (Toy_LiteralType)readByte(interpreter->bytecode, &interpreter->count); Toy_LiteralType literalType = (Toy_LiteralType)readByte(interpreter->bytecode, &interpreter->count);
unsigned char constant = readByte(interpreter->bytecode, &interpreter->count); unsigned char constant = readByte(interpreter->bytecode, &interpreter->count);