compiler: refactor convertToken func

Move `getEqualityOpcode` into `convertToken`.
`convertToken` does not need codegen.
This commit is contained in:
Evgenii Stratonikov 2020-08-23 12:39:58 +03:00
parent ae88c77a8a
commit fd7af77895
3 changed files with 79 additions and 69 deletions

View file

@ -31,6 +31,11 @@ func isByte(typ types.Type) bool {
return isBasicTypeOfKind(typ, types.Uint8, types.Int8)
}
func isNumber(typ types.Type) bool {
t, ok := typ.Underlying().(*types.Basic)
return ok && t.Info()&types.IsNumeric != 0
}
func isString(typ types.Type) bool {
return isBasicTypeOfKind(typ, types.String)
}