Constant Default Parameter Support #98

Merged
sb10q merged 7 commits from default_parameter into master 2021-11-23 07:32:09 +08:00
Showing only changes of commit e75ec35687 - Show all commits

View File

@ -354,7 +354,10 @@ impl TopLevelComposer {
if let Ok(v) = v.try_into() {
Ok(SymbolValue::I32(v))
} else {
Ok(SymbolValue::I64(v.try_into().unwrap()))
Err(format!(
ychenfo marked this conversation as resolved Outdated

Should we just accept int32? int64 is handled in the call part, e.g. int64(1234).

Should we just accept int32? int64 is handled in the call part, e.g. `int64(1234)`.

this is handled in the new commit below

this is handled in the new commit below
"int64 default parameter should be specified explicitly by `int64()` at {}",
ychenfo marked this conversation as resolved Outdated
Outdated
Review

Isn't that an internal compiler error if this code is executed, not a problem with the user code?
Using unreachable!() sounds more appropriate here.

Isn't that an internal compiler error if this code is executed, not a problem with the user code? Using ``unreachable!()`` sounds more appropriate here.
Outdated
Review

Isn't that an internal compiler error if this code is executed, not a problem with the user code?
Using unreachable!() sounds more appropriate here.

Isn't that an internal compiler error if this code is executed, not a problem with the user code? Using ``unreachable!()`` sounds more appropriate here.

No I don't think so? It is possible for users to specify some default value outside the range of int64. I think a more appropriate error message would be value out of range and only say int64 if the value is really an int64?

No I don't think so? It is possible for users to specify some default value outside the range of int64. I think a more appropriate error message would be value out of range and only say `int64` if the value is really an int64?
Outdated
Review

OK, yes.

OK, yes.

Thanks, this error message is updated in the new commit

Thanks, this error message is updated in the new commit
loc
))
}
}
Constant::Float(v) => Ok(SymbolValue::Double(*v)),