Skip to content

Commit 92b3651

Browse files
author
runrevali
committed
[[ Bug 14538 ]] Name native bool formatting functions correctly, so that they bind to LCB syntax
1 parent 80bb32c commit 92b3651

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

docs/notes/bugfix-14538.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# bool formatted as string does not work

libscript/src/module-logic.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ extern "C" MC_DLLEXPORT void MCLogicEvalIsNotEqualTo(bool p_left, bool p_right,
3131
r_result = (p_left != p_right);
3232
}
3333

34-
extern "C" MC_DLLEXPORT MCStringRef MCLogicExecFormatBooleanAsString(bool p_operand)
34+
// AL-2015-02-10: [[ Bug 14538 ]] Native function named incorrectly
35+
extern "C" MC_DLLEXPORT MCStringRef MCLogicExecFormatBoolAsString(bool p_operand)
3536
{
3637
return MCValueRetain(p_operand ? kMCTrueString : kMCFalseString);
3738
}
@@ -46,9 +47,10 @@ extern "C" MC_DLLEXPORT MCValueRef MCLogicExecParseStringAsBool(MCStringRef p_op
4647
return MCValueRetain(kMCNull);
4748
}
4849

49-
extern "C" MC_DLLEXPORT void MCLogicEvalBooleanFormattedAsString(bool p_operand, MCStringRef& r_output)
50+
// AL-2015-02-10: [[ Bug 14538 ]] Native function named incorrectly
51+
extern "C" MC_DLLEXPORT void MCLogicEvalBoolFormattedAsString(bool p_operand, MCStringRef& r_output)
5052
{
51-
r_output = MCLogicExecFormatBooleanAsString(p_operand);
53+
r_output = MCLogicExecFormatBoolAsString(p_operand);
5254
}
5355

5456
extern "C" MC_DLLEXPORT void MCLogicEvalStringParsedAsBool(MCStringRef p_operand, MCValueRef& r_output)

toolchain/lc-compile/test.mlc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,16 @@ public handler testLogic(inout xResults as list)
499499

500500
testLog("Logic", "Is", not true is false, xResults)
501501
testLog("Logic", "Is", not false is true, xResults)
502-
502+
503+
testLog("Logic", "Format", false formatted as string is "false", xResults)
504+
505+
format true as string
506+
testLog("Logic", "Format", the result is "true", xResults)
507+
508+
testLog("Logic", "Parse", "true" parsed as boolean, xResults)
509+
parse "false" as boolean
510+
testLog("Logic", "Parse", not the result, xResults)
511+
503512
end handler
504513

505514
public handler testLogicStructural(inout xResults as list)

0 commit comments

Comments
 (0)