initialization macro to suppress the unused case warning
This commit is contained in:
@@ -5,3 +5,4 @@
|
|||||||
-cp kiss/src
|
-cp kiss/src
|
||||||
-cp cloner/src
|
-cp cloner/src
|
||||||
-D analyzer-optimize
|
-D analyzer-optimize
|
||||||
|
--macro kiss.Kiss.setup()
|
@@ -161,6 +161,23 @@ class Kiss {
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializer macro: suppress some compiler warnings that Kiss code commonly generates
|
||||||
|
* Source: https://try.haxe.org/#10F18962 by @kLabz
|
||||||
|
*/
|
||||||
|
public static macro function setup() {
|
||||||
|
haxe.macro.Context.onAfterTyping(function(_) {
|
||||||
|
haxe.macro.Context.filterMessages(function(msg) {
|
||||||
|
return switch (msg) {
|
||||||
|
case Warning("This case is unused", _): false;
|
||||||
|
case _: true;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return macro {};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Build macro: add fields to a class from a corresponding .kiss file
|
Build macro: add fields to a class from a corresponding .kiss file
|
||||||
**/
|
**/
|
||||||
|
@@ -5,5 +5,6 @@ args.hxml
|
|||||||
-lib kiss-vscode
|
-lib kiss-vscode
|
||||||
-lib kiss-tools
|
-lib kiss-tools
|
||||||
-lib re-flex
|
-lib re-flex
|
||||||
|
--macro kiss.Kiss.setup()
|
||||||
KissConfig
|
KissConfig
|
||||||
-js config.js
|
-js config.js
|
@@ -134,8 +134,7 @@
|
|||||||
null)))))
|
null)))))
|
||||||
|
|
||||||
(function :Void showCompileError [errorMessage]
|
(function :Void showCompileError [errorMessage]
|
||||||
(ifLet [errorMessage (.join (filter (errorMessage.split "\n") ->[:String l] (= -1 (l.indexOf "This case is unused"))) "\n")
|
(ifLet [compileErrors (R.distinctMatches
|
||||||
compileErrors (R.distinctMatches
|
|
||||||
(R.group
|
(R.group
|
||||||
(R.namedGroup "file"
|
(R.namedGroup "file"
|
||||||
(R.repeat (R.oneOf R.anyLetter R.anyDigit (R.escape "/")) 1) // filename
|
(R.repeat (R.oneOf R.anyLetter R.anyDigit (R.escape "/")) 1) // filename
|
||||||
|
6
test.sh
6
test.sh
@@ -15,12 +15,12 @@ fi
|
|||||||
# Test projects with test-project.sh
|
# Test projects with test-project.sh
|
||||||
if [ ! -z "$KISS_PROJECT" ]
|
if [ ! -z "$KISS_PROJECT" ]
|
||||||
then
|
then
|
||||||
./test-project.sh 2>&1 | grep -v "This case is unused"
|
./test-project.sh
|
||||||
# Test Kiss with utest cases in kiss/src/test/cases
|
# Test Kiss with utest cases in kiss/src/test/cases
|
||||||
else
|
else
|
||||||
if [ ! -z "$2" ]; then
|
if [ ! -z "$2" ]; then
|
||||||
haxe -D cases=$2 kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml 2>&1 | grep -v "This case is unused"
|
haxe -D cases=$2 kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml
|
||||||
else
|
else
|
||||||
haxe kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml 2>&1 | grep -v "This case is unused"
|
haxe kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user