Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 4dbe0b0

Browse files
author
Ian Macphail
committed
[[ Build ]] Rename assert type enum entries
This patch renames the entries of the Assert_type enumeration, adding the 'ASSERT_' prefix to give a more meaningful name and to avoid conflicts with values from other enumerations Fixes 'Declaration shadows a variable in the global namespace' compiler error
1 parent 57500b0 commit 4dbe0b0

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

engine/src/cmds.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,39 +1580,39 @@ Parse_stat MCAssertCmd::parse(MCScriptPoint& sp)
15801580
// See if there is a type token
15811581
MCScriptPoint temp_sp(sp);
15821582
if (sp . skip_token(SP_SUGAR, TT_UNDEFINED, SG_TRUE) == PS_NORMAL)
1583-
m_type = TYPE_TRUE;
1583+
m_type = ASSERT_TYPE_TRUE;
15841584
else if (sp . skip_token(SP_SUGAR, TT_UNDEFINED, SG_FALSE) == PS_NORMAL)
1585-
m_type = TYPE_FALSE;
1585+
m_type = ASSERT_TYPE_FALSE;
15861586
else if (sp . skip_token(SP_SUGAR, TT_UNDEFINED, SG_SUCCESS) == PS_NORMAL)
1587-
m_type = TYPE_SUCCESS;
1587+
m_type = ASSERT_TYPE_SUCCESS;
15881588
else if (sp . skip_token(SP_SUGAR, TT_UNDEFINED, SG_FAILURE) == PS_NORMAL)
1589-
m_type = TYPE_FAILURE;
1589+
m_type = ASSERT_TYPE_FAILURE;
15901590
else
1591-
m_type = TYPE_NONE;
1591+
m_type = ASSERT_TYPE_NONE;
15921592

15931593
// Now try to parse an expression
15941594
if (sp.parseexp(False, True, &m_expr) == PS_NORMAL)
15951595
return PS_NORMAL;
15961596

15971597
// Now if we are not of NONE type, then backup and try for just an
1598-
// expression (TYPE_NONE).
1599-
if (m_type != TYPE_NONE)
1598+
// expression (ASSERT_TYPE_NONE).
1599+
if (m_type != ASSERT_TYPE_NONE)
16001600
{
16011601
MCperror -> clear();
16021602
sp = temp_sp;
16031603
}
16041604

16051605
// Parse the expression again (if not NONE, otherwise we already have
16061606
// a badexpr error to report).
1607-
if (m_type == TYPE_NONE ||
1607+
if (m_type == ASSERT_TYPE_NONE ||
16081608
sp.parseexp(False, True, &m_expr) != PS_NORMAL)
16091609
{
16101610
MCperror -> add(PE_ASSERT_BADEXPR, sp);
16111611
return PS_ERROR;
16121612
}
16131613

16141614
// We must be of type none.
1615-
m_type = TYPE_NONE;
1615+
m_type = ASSERT_TYPE_NONE;
16161616

16171617
return PS_NORMAL;
16181618
}

engine/src/cmds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class MCAssertCmd: public MCStatement
3737
public:
3838
MCAssertCmd(void)
3939
{
40-
m_type = TYPE_NONE;
40+
m_type = ASSERT_TYPE_NONE;
4141
m_expr = nil;
4242
}
4343

engine/src/exec-debugging.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ void MCDebuggingExecAssert(MCExecContext& ctxt, int type, bool p_eval_success, b
392392
{
393393
switch(type)
394394
{
395-
case TYPE_NONE:
396-
case TYPE_TRUE:
395+
case ASSERT_TYPE_NONE:
396+
case ASSERT_TYPE_TRUE:
397397
// If the expression threw an error, then just throw.
398398
if (!p_eval_success)
399399
{
@@ -406,7 +406,7 @@ void MCDebuggingExecAssert(MCExecContext& ctxt, int type, bool p_eval_success, b
406406
return;
407407
break;
408408

409-
case TYPE_FALSE:
409+
case ASSERT_TYPE_FALSE:
410410
// If the expression threw an error, then just throw.
411411
if (!p_eval_success)
412412
{
@@ -419,12 +419,12 @@ void MCDebuggingExecAssert(MCExecContext& ctxt, int type, bool p_eval_success, b
419419
return;
420420
break;
421421

422-
case TYPE_SUCCESS:
422+
case ASSERT_TYPE_SUCCESS:
423423
if (p_eval_success)
424424
return;
425425
break;
426426

427-
case TYPE_FAILURE:
427+
case ASSERT_TYPE_FAILURE:
428428
if (!p_eval_success)
429429
return;
430430
break;

engine/src/parsedef.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ enum Ask_type {
7979
};
8080

8181
enum Assert_type {
82-
TYPE_NONE,
83-
TYPE_TRUE,
84-
TYPE_FALSE,
85-
TYPE_SUCCESS,
86-
TYPE_FAILURE,
82+
ASSERT_TYPE_NONE,
83+
ASSERT_TYPE_TRUE,
84+
ASSERT_TYPE_FALSE,
85+
ASSERT_TYPE_SUCCESS,
86+
ASSERT_TYPE_FAILURE,
8787
};
8888

8989
inline Chunk_term ct_class(Chunk_term src)

0 commit comments

Comments
 (0)