-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement assemble func prototype #72
Conversation
Moved |
7201216
to
c5b83a0
Compare
I think |
|
||
if !ok { | ||
return nil, errors.New("Invalid byteCode") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to predefine
var ErrInvalidOpcode = errors.New("Invalid byteCode")
and return ErrInvalidOpcode
_, err := assemble(rawByteCode) | ||
if err == nil { | ||
t.Error("The desired error was not found ") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to compare like this
if err != ErrInvalidOpcode{
t.Error("The desired error was not found ")
}
asm.jump(2) | ||
asm.jump(4) | ||
asm.jump(10) // Error occur | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is important to distinguish between cases where err occurs and cases that do not occur.
In cases where err does not occur, it is necessary to check whether asm's pc value is correctly jumped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
details:
We need to discuss about #60
But when we implement opCodes( #61 ), it needs
asm.code
( it is analyzed
rawByteCode
but the analysis is focused on cost maybe. )I think it is better to implement the analysis properly after it is fully discussed!! so i implement prototype of
analysis
...