Skip to content

Commit 0cfb4a2

Browse files
committed
[[ Element Chunk ]] Don't allow range expression for element chunk
1 parent 8695d38 commit 0cfb4a2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

engine/src/chunk.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Parse_stat MCChunk::parse(MCScriptPoint &sp, Boolean doingthe)
291291
sp.backup();
292292
return PS_NORMAL;
293293
case TT_TO:
294-
if (curref != NULL && lterm >= CT_LINE)
294+
if (curref != NULL && MCChunkTermHasRange(lterm))
295295
{
296296
if (curref->etype == CT_RANGE)
297297
{
@@ -5828,3 +5828,8 @@ bool MCChunkTermIsNestable(Chunk_term p_chunk_term)
58285828
return false;
58295829
}
58305830
}
5831+
5832+
bool MCChunkTermHasRange(Chunk_term p_chunk_term)
5833+
{
5834+
return p_chunk_term >= CT_LINE && p_chunk_term < CT_ELEMENT;
5835+
}

engine/src/chunk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,6 @@ class MCChunk : public MCExpression
265265

266266
MCChunkType MCChunkTypeFromChunkTerm(Chunk_term p_chunk_term);
267267
bool MCChunkTermIsNestable(Chunk_term p_chunk_term);
268+
bool MCChunkTermHasRange(Chunk_term p_chunk_term);
268269

269270
#endif

0 commit comments

Comments
 (0)