From 98ba861d9cfab20d1ddeadeb1585959bce39eee7 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 13 Jul 2024 18:47:57 -0600 Subject: [PATCH] make hollywooMethod macro usable in hollywoo implementation dsls --- src/hollywoo/Movie.kiss | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index 5fcf81b..431ab3e 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -1022,6 +1022,7 @@ (,mode ,@body) (otherwise (cc)))) +(defMacroVar avoidDuplicateDefinition true) // Some real magic happens here. This macro defines a method, AND a reader macro // for calling it with skipping and cc passed automatically if cc is an argument. // GOTCHA: DO NOT use (method) directly in this file outside of the above #unless subclass block!! @@ -1053,7 +1054,7 @@ (b.callSymbol "b.symbol" [(b.str "null")]) ])))))] methodCall)) - (#unless subclass @:keep (method ,nameAndType ,argList ,@body)) + (#when (or !subclass !avoidDuplicateDefinition) @:keep (method ,nameAndType ,argList ,@body)) })) (hollywooMethod :Void restorePlayMode [:Continuation cc] @@ -1612,4 +1613,7 @@ creditsTSV (makeCC (stopSong skipping cc)) - (director.getSongLength (dictGet songs songKey)))) \ No newline at end of file + (director.getSongLength (dictGet songs songKey)))) + +// This redefinition allows you to call (hollywooMethod) in your hollywoo implementation dsls and movie scripts: +(defMacroVar avoidDuplicateDefinition false) \ No newline at end of file