Merge pull request #917 from visualfc/conststring

ssa: fix const for named string
This commit is contained in:
xushiwei
2024-12-19 18:13:24 +08:00
committed by GitHub
4 changed files with 106 additions and 64 deletions

View File

@@ -243,7 +243,7 @@ func (b Builder) Const(v constant.Value, typ Type) Expr {
v, _ := constant.Float64Val(constant.ToFloat(v))
return prog.FloatVal(v, typ)
case kind == types.String:
return b.Str(constant.StringVal(v))
return Expr{b.Str(constant.StringVal(v)).impl, typ}
case kind == types.Complex128 || kind == types.Complex64:
v = constant.ToComplex(v)
re, _ := constant.Float64Val(constant.Real(v))