From 43e6523fd42f736acfcd0c32d82246c262e07a1d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 10 Sep 2018 15:55:34 -0700 Subject: Shifting towards more text methods instead of text global functions. Also fixed a bug with method call parenthesizing. --- core/errors.nom | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/errors.nom') diff --git a/core/errors.nom b/core/errors.nom index 874f2fe..638b487 100644 --- a/core/errors.nom +++ b/core/errors.nom @@ -18,6 +18,19 @@ compile [assume %condition] to: error(\(quote "\%assumption"), 0) end +compile [assume %a == %b] to: + lua> ".." + local \%assumption = 'Assumption failed: '..tostring(nomsu:tree_to_nomsu(\(\(%a == %b)))) + define mangler + return (..) + Lua ".." + do + local \(mangle "a"), \(mangle "b") = \(%a as lua expr), \(%b as lua expr) + if \(mangle "a") ~= \(mangle "b") then + error(\(quote "\%assumption").."\\n"..tostring(\(mangle "a")).." != "..tostring(\(mangle "b")), 0) + end + end + compile [assume %condition or barf %message] to (..) Lua ".." if not \(%condition as lua expr) then -- cgit v1.2.3