From e808774e002cfd55a66d8b8aa5eaea6d7f792a58 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 6 Jul 2024 23:12:23 -0600 Subject: [PATCH] buildExpectingError handle top-level begin main --- src/kiss/Kiss.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kiss/Kiss.hx b/src/kiss/Kiss.hx index 346892f..e5b2d11 100644 --- a/src/kiss/Kiss.hx +++ b/src/kiss/Kiss.hx @@ -448,7 +448,7 @@ class Kiss { k.addContextFields(useClassFields); k.loadingDirectory = loadingDirectory; - var topLevelBegin = load(kissFile, k); + var topLevelBegin = load(kissFile, k, null, null, null, expectedError); if (topLevelBegin != null) { // If no main function is defined manually, Kiss expressions at the top of a file will be put in a main function. @@ -492,7 +492,7 @@ class Kiss { static final SIGNIFICANT_TIME_SPENT = 0.05; - public static function load(kissFile:String, k:KissState, ?loadingDirectory:String, loadAllExps = false, ?fromExp:ReaderExp):Null { + public static function load(kissFile:String, k:KissState, ?loadingDirectory:String, loadAllExps = false, ?fromExp:ReaderExp, ?expectedError:EType):Null { if (loadingDirectory == null) loadingDirectory = k.loadingDirectory; @@ -532,7 +532,7 @@ class Kiss { // readerExpToHaxeExpr must be called to process readermacro, alias, and macro definitions macroUsed = false; - var expr = _try(()->readerExpToHaxeExpr(nextExp, k)); + var expr = _try(()->readerExpToHaxeExpr(nextExp, k), expectedError); // exps in the loaded file that actually become haxe expressions can be inserted into the // file that loaded them at the position (load) was called.