Skip to content

Commit deec504

Browse files
committed
[[ Element Chunk ]] Error when using element chunk in anything other than property context
1 parent 84ef6e7 commit deec504

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

engine/src/chunk.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,8 +3139,12 @@ void MCChunk::eval_ctxt(MCExecContext &ctxt, MCExecValue &r_text)
31393139
MCAutoValueRef t_valueref;
31403140
bool t_exec_expr = false;
31413141

3142-
if (source != NULL && url == NULL && stack == NULL && background == NULL && card == NULL
3143-
&& group == NULL && object == NULL)
3142+
if (iselementchunk())
3143+
{
3144+
ctxt . LegacyThrow(EE_CHUNK_OBJECTNOTCONTAINER);
3145+
return;
3146+
}
3147+
else if (source != NULL && url == NULL && noobjectchunks())
31443148
{
31453149
if (desttype != DT_OWNER)
31463150
{
@@ -3534,7 +3538,12 @@ Exec_stat MCChunk::set_legacy(MCExecPoint &ep, Preposition_type ptype)
35343538

35353539
bool MCChunk::set(MCExecContext &ctxt, Preposition_type p_type, MCValueRef p_value, bool p_unicode)
35363540
{
3537-
if (destvar != nil)
3541+
if (iselementchunk())
3542+
{
3543+
ctxt . LegacyThrow(EE_CHUNK_SETNOTACONTAINER);
3544+
return false;
3545+
}
3546+
else if (destvar != nil)
35383547
{
35393548
MCVariableChunkPtr t_var_chunk;
35403549
if (!evalvarchunk(ctxt, false, true, t_var_chunk))
@@ -3618,7 +3627,12 @@ bool MCChunk::set(MCExecContext &ctxt, Preposition_type p_type, MCValueRef p_val
36183627

36193628
bool MCChunk::set(MCExecContext &ctxt, Preposition_type p_type, MCExecValue p_value, bool p_unicode)
36203629
{
3621-
if (destvar != nil)
3630+
if (iselementchunk())
3631+
{
3632+
ctxt . LegacyThrow(EE_CHUNK_SETNOTACONTAINER);
3633+
return false;
3634+
}
3635+
else if (destvar != nil)
36223636
{
36233637
MCVariableChunkPtr t_var_chunk;
36243638
if (!evalvarchunk(ctxt, false, true, t_var_chunk))

0 commit comments

Comments
 (0)