From da2cfb60acd93c4b3c8c48b9d4143e56c752cd50 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Wed, 24 Jul 2024 16:39:40 +0200 Subject: [PATCH 1/2] chore: remove panic from uverse --- gnovm/pkg/gnolang/uverse.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/gnovm/pkg/gnolang/uverse.go b/gnovm/pkg/gnolang/uverse.go index 880a75396ca..38ccdddea85 100644 --- a/gnovm/pkg/gnolang/uverse.go +++ b/gnovm/pkg/gnolang/uverse.go @@ -928,17 +928,7 @@ func UverseNode() *PackageNode { return }, ) - defNative("panic", - Flds( // params - "err", AnyT(), // args[0] - ), - nil, // results - func(m *Machine) { - arg0 := m.LastBlock().GetParams1() - xv := arg0.Deref() - panic(xv.Sprint(m)) - }, - ) + // NOTE: panic is its own statement type, and is not defined as a function. defNative("print", Flds( // params "xs", Vrd(AnyT()), // args[0] From bb8186fe357b3bf0fe00853e8464e0fc51c07f74 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Wed, 24 Jul 2024 17:49:14 +0200 Subject: [PATCH 2/2] fix isUverseName --- gnovm/pkg/gnolang/misc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnovm/pkg/gnolang/misc.go b/gnovm/pkg/gnolang/misc.go index a05de8c74aa..7f7ce0b3a87 100644 --- a/gnovm/pkg/gnolang/misc.go +++ b/gnovm/pkg/gnolang/misc.go @@ -150,6 +150,10 @@ func isReservedName(n Name) bool { // scans uverse static node for blocknames. (slow) func isUverseName(n Name) bool { + if n == "panic" { + // panic is not in uverse, as it is parsed as its own statement (PanicStmt) + return true + } uverseNames := UverseNode().GetBlockNames() for _, name := range uverseNames { if name == n {