Skip to content

Commit 8970037

Browse files
committed
[[ RefactorSyntax ]] Changed MCConstant and MCLiteral* to use eval_ctxt.
[[ RefactorSyntax ]] Changed ES_EXIT_SWITCH case in execute commands back to return ES_NORMAL.
1 parent b6fcd53 commit 8970037

6 files changed

Lines changed: 467 additions & 12 deletions

File tree

engine/src/constant.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
2525

2626
#include "syntax.h"
2727

28+
#ifdef /* MCConstant::eval */ LEGACY_EXEC
2829
Exec_stat MCConstant::eval(MCExecPoint &ep)
2930
{
3031
if (nvalue == BAD_NUMERIC)
@@ -33,6 +34,21 @@ Exec_stat MCConstant::eval(MCExecPoint &ep)
3334
ep.setnvalue(nvalue);
3435
return ES_NORMAL;
3536
}
37+
#endif
38+
39+
void MCConstant::eval_ctxt(MCExecContext& ctxt, MCExecValue& r_value)
40+
{
41+
if (nvalue == BAD_NUMERIC)
42+
{
43+
r_value . type = kMCExecValueTypeStringRef;
44+
r_value . stringref_value = MCValueRetain(svalue);
45+
}
46+
else
47+
{
48+
r_value . type = kMCExecValueTypeDouble;
49+
r_value . double_value = nvalue;
50+
}
51+
}
3652

3753
void MCConstant::compile(MCSyntaxFactoryRef ctxt)
3854
{

engine/src/constant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MCConstant : public MCExpression
3535
MCValueRelease(svalue);
3636
}
3737

38-
virtual Exec_stat eval(MCExecPoint &ep);
38+
virtual void eval_ctxt(MCExecContext& ctxt, MCExecValue& r_value);
3939

4040
virtual void compile(MCSyntaxFactoryRef ctxt);
4141
};

0 commit comments

Comments
 (0)