cl: compileValue check types.Default for const
This commit is contained in:
@@ -473,7 +473,7 @@ func (p *context) compileValue(b llssa.Builder, v ssa.Value) llssa.Expr {
|
|||||||
g := p.varOf(v)
|
g := p.varOf(v)
|
||||||
return g.Expr
|
return g.Expr
|
||||||
case *ssa.Const:
|
case *ssa.Const:
|
||||||
t := v.Type()
|
t := types.Default(v.Type())
|
||||||
return b.Const(v.Value, p.prog.Type(t))
|
return b.Const(v.Value, p.prog.Type(t))
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("compileValue: unknown value - %T\n", v))
|
panic(fmt.Sprintf("compileValue: unknown value - %T\n", v))
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ func (b Builder) Const(v constant.Value, typ Type) Expr {
|
|||||||
if v == nil {
|
if v == nil {
|
||||||
return prog.Null(typ)
|
return prog.Null(typ)
|
||||||
}
|
}
|
||||||
switch t := types.Default(typ.t).(type) {
|
switch t := typ.t.(type) {
|
||||||
case *types.Basic:
|
case *types.Basic:
|
||||||
kind := t.Kind()
|
kind := t.Kind()
|
||||||
switch {
|
switch {
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ func (p Program) tyInt64() llvm.Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p Program) toLLVMType(typ types.Type) Type {
|
func (p Program) toLLVMType(typ types.Type) Type {
|
||||||
switch t := types.Default(typ).(type) {
|
switch t := typ.(type) {
|
||||||
case *types.Basic:
|
case *types.Basic:
|
||||||
switch t.Kind() {
|
switch t.Kind() {
|
||||||
case types.Int:
|
case types.Int:
|
||||||
|
|||||||
Reference in New Issue
Block a user