fix assert error insertion on windows
This commit is contained in:
@@ -305,6 +305,7 @@ class Macros {
|
|||||||
var b = wholeExp.expBuilder();
|
var b = wholeExp.expBuilder();
|
||||||
var expression = exps[0];
|
var expression = exps[0];
|
||||||
var failureError = KissError.fromExp(wholeExp, "").toString(AssertionFail);
|
var failureError = KissError.fromExp(wholeExp, "").toString(AssertionFail);
|
||||||
|
var colonsInPrefix = if (Sys.systemName() == "Windows") 5 else 4;
|
||||||
var messageExp = if (exps.length > 1) {
|
var messageExp = if (exps.length > 1) {
|
||||||
exps[1];
|
exps[1];
|
||||||
} else {
|
} else {
|
||||||
@@ -320,7 +321,7 @@ class Macros {
|
|||||||
letVal,
|
letVal,
|
||||||
letVal,
|
letVal,
|
||||||
b.callSymbol("throw", [
|
b.callSymbol("throw", [
|
||||||
b.callSymbol("kiss.Prelude.runtimeInsertAssertionMessage", [messageExp, b.str(failureError)])
|
b.callSymbol("kiss.Prelude.runtimeInsertAssertionMessage", [messageExp, b.str(failureError), b.int(colonsInPrefix)])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@@ -723,9 +723,9 @@ class Prelude {
|
|||||||
return str.substr(negIdx(startIdx), negIdx(endIdx));
|
return str.substr(negIdx(startIdx), negIdx(endIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function runtimeInsertAssertionMessage(message:String, error:String) {
|
public static function runtimeInsertAssertionMessage(message:String, error:String, colonsInPrefix:Int) {
|
||||||
var colonIdx = 0;
|
var colonIdx = 0;
|
||||||
for (_ in 0...4) {
|
for (_ in 0...colonsInPrefix) {
|
||||||
colonIdx = error.indexOf(":", colonIdx) + 1;
|
colonIdx = error.indexOf(":", colonIdx) + 1;
|
||||||
}
|
}
|
||||||
colonIdx += 1;
|
colonIdx += 1;
|
||||||
|
@@ -50,6 +50,9 @@
|
|||||||
(method &override :Void update [:Float elapsed]
|
(method &override :Void update [:Float elapsed]
|
||||||
(super.update elapsed)
|
(super.update elapsed)
|
||||||
|
|
||||||
|
(when FlxG.keys.justPressed.ESCAPE
|
||||||
|
(Sys.exit 0))
|
||||||
|
|
||||||
// Press ENTER to type a command to run
|
// Press ENTER to type a command to run
|
||||||
(when (and !textInput FlxG.keys.justPressed.ENTER)
|
(when (and !textInput FlxG.keys.justPressed.ENTER)
|
||||||
(typeCommand))
|
(typeCommand))
|
||||||
|
Reference in New Issue
Block a user