aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2023-06-01 10:41:36 -0700
committerRon Evans <[email protected]>2023-06-09 17:30:02 +0200
commitf5f4751088bd40a8680899eefeb9854c8dbf4b33 (patch)
treeb7a20ff88c6f31d368fcc783a6a92fa81021ab33 /compiler
parent62fb386d57a0080881c756000e42a2c873372eb8 (diff)
downloadtinygo-f5f4751088bd40a8680899eefeb9854c8dbf4b33.tar.gz
tinygo-f5f4751088bd40a8680899eefeb9854c8dbf4b33.zip
compiler,transform: fix for pointer-to-pointer type switches from @aykevl
Diffstat (limited to 'compiler')
-rw-r--r--compiler/interface.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/interface.go b/compiler/interface.go
index 7b49a81d4..3fdb30bb8 100644
--- a/compiler/interface.go
+++ b/compiler/interface.go
@@ -683,11 +683,8 @@ func (b *builder) createTypeAssert(expr *ssa.TypeAssert) llvm.Value {
commaOk = b.CreateCall(fn.GlobalValueType(), fn, []llvm.Value{actualTypeNum}, "")
} else {
- assertedTypeGlobal := b.getTypeCode(expr.AssertedType)
- if !assertedTypeGlobal.IsAConstantExpr().IsNil() {
- assertedTypeGlobal = assertedTypeGlobal.Operand(0) // resolve the GEP operation
- }
- globalName := "reflect/types.typeid:" + strings.TrimPrefix(assertedTypeGlobal.Name(), "reflect/types.type:")
+ name, _ := getTypeCodeName(expr.AssertedType)
+ globalName := "reflect/types.typeid:" + name
assertedTypeCodeGlobal := b.mod.NamedGlobal(globalName)
if assertedTypeCodeGlobal.IsNil() {
// Create a new typecode global.