all repos — min @ 283a5a4b99d8eb7952099d26d237ae5a33f7928c

A small but practical concatenative programming language.

Fixed constructor processing in operator.
h3rald h3rald@h3rald.com
Wed, 03 Jun 2026 07:04:11 +0200
commit

283a5a4b99d8eb7952099d26d237ae5a33f7928c

parent

df6d165c853084c7b16681b014e12e9cffc11183

1 files changed, 5 insertions(+), 6 deletions(-)

jump to
M minpkg/lib/min_global.nimminpkg/lib/min_global.nim

@@ -240,8 +240,7 @@ raiseInvalid("Invalid operator definition")

let tv = q.qVal[0] let t = tv.symVal let nv = q.qVal[1] - if not tv.isSymbol or (not ["symbol", "sigil", "typeclass", - "constructor"].contains(t)): + if not tv.isSymbol or (not ["symbol", "sigil", "typeclass", "constructor"].contains(t)): raiseInvalid("Incorrect operator type specified (it must be 'symbol', 'sigil', 'constructor', or 'typeclass' - found '$#')" % tv.symVal) if not nv.isSymbol: raiseInvalid("Operator name must be a symbol")

@@ -371,9 +370,10 @@ except MinReturnException:

discard # Validate output for k in 0..outVars.len-1: - var x = i.scope.symbols[outVars[k]].val + # Convenience copy for validation + let x = i.scope.symbols[outVars[k]].val if t == "constructor": - x.objType = n + i.scope.symbols[outVars[k]].val.objType = n if DEV: let o = outExpects[k] var r = false;

@@ -390,8 +390,7 @@ var tp = o

if generics.hasKey(o): tp = generics[o] generics = origGenerics - raiseInvalid("Invalid value for output symbol '$#'. Expected $#, found $#" % - [outVars[k], tp, $x]) + raiseInvalid("Invalid value for output symbol '$#'. Expected $#, found $#" % [outVars[k], tp, $x]) # Push output on stack debug "Operator - pushing: $#" % [outVars[k]] i.pushSym outVars[k]