Closed boohyunsik closed 5 years ago
@boohyunsik Return value could be integer, string or void! So, I think you should separate their type.
If return value is integer, you should return only that integer value!
If return value is string, you should return memory offset and size of that string.
If return value is void, you should return memory offset and size 0.
Otherwise (if return value is not integer, string or void, but expression), you should execute compileExpression()
function.
@boohyunsik Return value could be integer, string or void! So, I think you should separate their type.
If return value is integer, you should return only that integer value! If return value is string, you should return memory offset and size of that string. If return value is void, you should return memory offset and size 0. Otherwise (if return value is not integer, string or void, but expression), you should execute
compileExpression()
function.
But in compileExpression(), the cases of integer, string, boolean are already defined.
When compileStringExpression()
is merged to develop, add the test case for string. Then, this might be merged.
resolved: #218
Implements compileReturnStatement and test cases