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

Commit 2eb6dc8

Browse files
committed
[[ RefactorIt ]] Removed direct references to 'it' from syntax classes and moved to being referenced via ep.
1 parent 2b269a9 commit 2eb6dc8

24 files changed

+130
-176
lines changed

engine/src/answer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ const char *MCdialogtypes[] =
6363

6464
MCAnswer::~MCAnswer()
6565
{
66-
delete it;
6766
delete title;
6867

6968
switch(mode)
@@ -105,7 +104,6 @@ Parse_stat MCAnswer::parse(MCScriptPoint &sp)
105104
const LT *t_literal;
106105

107106
initpoint(sp);
108-
getit(sp, it);
109107

110108
if (sp . skip_token(SP_ASK, TT_UNDEFINED, AT_PAGE) == PS_NORMAL)
111109
{
@@ -352,7 +350,7 @@ Exec_stat MCAnswer::exec(MCExecPoint& ep)
352350
}
353351

354352
if (!t_error)
355-
it -> set(ep);
353+
ep . getit() -> set(ep);
356354
else
357355
MCeerror -> add(t_error, line, pos);
358356

engine/src/answer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
3636
class MCAnswer : public MCStatement
3737
{
3838
Ask_type mode;
39-
MCVarref *it;
4039
MCExpression *title;
4140
Boolean sheet;
4241

@@ -71,7 +70,6 @@ class MCAnswer : public MCStatement
7170
MCAnswer()
7271
{
7372
mode = AT_UNDEFINED;
74-
it = NULL;
7573
sheet = False;
7674
title = NULL;
7775
notify . prompt = NULL;

engine/src/ask.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ extern const char *MCdialogtypes[];
4646

4747
MCAsk::~MCAsk(void)
4848
{
49-
delete it;
5049
delete title;
5150

5251
switch(mode)
@@ -81,7 +80,6 @@ Parse_stat MCAsk::parse(MCScriptPoint &sp)
8180
const LT *t_literal;
8281

8382
initpoint(sp);
84-
getit(sp, it);
8583

8684
if (sp . next(t_type) == PS_NORMAL)
8785
if (sp . lookup(SP_ASK, t_literal) == PS_NORMAL)
@@ -248,7 +246,7 @@ Exec_stat MCAsk::exec(class MCExecPoint& ep)
248246
}
249247

250248
if (!t_error)
251-
it -> set(ep);
249+
ep . getit() -> set(ep);
252250
else
253251
MCeerror -> add(t_error, line, pos);
254252

engine/src/ask.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
3636
class MCAsk : public MCStatement
3737
{
3838
Ask_type mode;
39-
MCVarref *it;
4039
MCExpression *title;
4140
Boolean sheet;
4241

@@ -72,7 +71,6 @@ class MCAsk : public MCStatement
7271
file . types = NULL;
7372
file . type_count = 0;
7473
mode = AT_UNDEFINED;
75-
it = NULL;
7674
sheet = False;
7775
}
7876
virtual ~MCAsk(void);

engine/src/cmds.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ MCConvert::~MCConvert()
121121
{
122122
delete container;
123123
delete source;
124-
delete it;
125124
}
126125

127126
Parse_stat MCConvert::parse(MCScriptPoint &sp)
@@ -142,7 +141,6 @@ Parse_stat MCConvert::parse(MCScriptPoint &sp)
142141
(PE_CONVERT_NOCONTAINER, sp);
143142
return PS_ERROR;
144143
}
145-
getit(sp, it);
146144
}
147145
else
148146
MCerrorlock--;
@@ -282,12 +280,11 @@ Exec_stat MCConvert::exec(MCExecPoint &ep)
282280
return ES_NORMAL;
283281
}
284282
Exec_stat stat;
285-
if (it != NULL)
286-
stat = it->set
287-
(ep);
283+
if (container == NULL)
284+
stat = ep . getit() -> set(ep);
288285
else
289-
stat = container->set
290-
(ep, PT_INTO);
286+
stat = container->set(ep, PT_INTO);
287+
291288
if (stat != ES_NORMAL)
292289
{
293290
MCeerror->add
@@ -656,7 +653,6 @@ Exec_stat MCFind::exec(MCExecPoint &ep)
656653
MCGet::~MCGet()
657654
{
658655
delete value;
659-
delete it;
660656
}
661657

662658
Parse_stat MCGet::parse(MCScriptPoint &sp)
@@ -668,7 +664,6 @@ Parse_stat MCGet::parse(MCScriptPoint &sp)
668664
(PE_GET_BADEXP, sp);
669665
return PS_ERROR;
670666
}
671-
getit(sp, it);
672667
return PS_NORMAL;
673668
}
674669

@@ -680,8 +675,7 @@ Exec_stat MCGet::exec(MCExecPoint &ep)
680675
(EE_GET_BADEXP, line, pos);
681676
return ES_ERROR;
682677
}
683-
if (it->set
684-
(ep) != ES_NORMAL)
678+
if (ep.getit()->set(ep) != ES_NORMAL)
685679
{
686680
MCeerror->add
687681
(EE_GET_CANTSET, line, pos, ep.getsvalue());

engine/src/cmds.h

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class MCConvert : public MCStatement
4343
{
4444
MCChunk *container;
4545
MCExpression *source;
46-
MCVarref *it;
4746
Convert_form fform;
4847
Convert_form fsform;
4948
Convert_form pform;
@@ -53,7 +52,6 @@ class MCConvert : public MCStatement
5352
{
5453
container = NULL;
5554
source = NULL;
56-
it = NULL;
5755
fform = CF_UNDEFINED;
5856
fsform = CF_UNDEFINED;
5957
pform = CF_UNDEFINED;
@@ -155,12 +153,10 @@ class MCFind : public MCStatement
155153
class MCGet : public MCStatement
156154
{
157155
MCExpression *value;
158-
MCVarref *it;
159156
public:
160157
MCGet()
161158
{
162159
value = NULL;
163-
it = NULL;
164160
}
165161
virtual ~MCGet();
166162
virtual Parse_stat parse(MCScriptPoint &);
@@ -210,12 +206,10 @@ class MCPost : public MCStatement
210206
{
211207
MCExpression *source;
212208
MCExpression *dest;
213-
MCVarref *it;
214209
public:
215210
MCPost()
216211
{
217212
source = dest = NULL;
218-
it = NULL;
219213
}
220214
virtual ~MCPost();
221215
virtual Parse_stat parse(MCScriptPoint &);
@@ -412,14 +406,12 @@ class MCClone : public MCStatement
412406
{
413407
MCChunk *source;
414408
MCExpression *newname;
415-
MCVarref *it;
416409
Boolean visible;
417410
public:
418411
MCClone()
419412
{
420413
source = NULL;
421414
newname = NULL;
422-
it = NULL;
423415
visible = True;
424416
}
425417
virtual ~MCClone();
@@ -431,14 +423,12 @@ class MCClipboardCmd: public MCStatement
431423
{
432424
MCChunk *targets;
433425
MCChunk *dest;
434-
MCVarref *it;
435426

436427
public:
437428
MCClipboardCmd(void)
438429
{
439430
targets = NULL;
440431
dest = NULL;
441-
it = NULL;
442432
}
443433

444434
virtual ~MCClipboardCmd(void);
@@ -450,8 +440,8 @@ class MCClipboardCmd: public MCStatement
450440
virtual bool iscut(void) const = 0;
451441

452442
private:
453-
Exec_errors processtocontainer(MCObjectRef *p_objects, uint4 p_object_count, MCObject *p_dst);
454-
Exec_errors processtoclipboard(MCObjectRef *p_objects, uint4 p_object_count);
443+
Exec_errors processtocontainer(MCExecPoint& ep, MCObjectRef *p_objects, uint4 p_object_count, MCObject *p_dst);
444+
Exec_errors processtoclipboard(MCExecPoint& ep, MCObjectRef *p_objects, uint4 p_object_count);
455445
};
456446

457447
class MCCopyCmd: public MCClipboardCmd
@@ -473,7 +463,6 @@ class MCCreate : public MCStatement
473463
MCExpression *newname;
474464
MCExpression *file;
475465
MCChunk *container;
476-
MCVarref *it;
477466
Boolean directory;
478467
Boolean visible;
479468
Boolean alias;
@@ -484,7 +473,6 @@ class MCCreate : public MCStatement
484473
newname = NULL;
485474
file = NULL;
486475
container = NULL;
487-
it = NULL;
488476
directory = False;
489477
alias = False;
490478
visible = True;
@@ -710,11 +698,9 @@ class MCMakeGroup : public MCStatement
710698

711699
class MCPasteCmd : public MCStatement
712700
{
713-
MCVarref *it;
714701
public:
715702
MCPasteCmd()
716703
{
717-
it = NULL;
718704
}
719705
virtual ~MCPasteCmd();
720706
virtual Parse_stat parse(MCScriptPoint &);
@@ -962,7 +948,6 @@ class MCDispatchCmd: public MCStatement
962948
MCExpression *message;
963949
MCChunk *target;
964950
MCParameter *params;
965-
MCVarref *it;
966951
bool is_function;
967952

968953
public:
@@ -971,7 +956,6 @@ class MCDispatchCmd: public MCStatement
971956
message = NULL;
972957
target = NULL;
973958
params = NULL;
974-
it = NULL;
975959
is_function = false;
976960
}
977961
~MCDispatchCmd(void);
@@ -1148,13 +1132,11 @@ class MCRequest : public MCStatement
11481132
{
11491133
MCExpression *message;
11501134
MCExpression *program;
1151-
MCVarref *it;
11521135
Apple_event ae;
11531136
public:
11541137
MCRequest()
11551138
{
11561139
message = program = NULL;
1157-
it = NULL;
11581140
ae = AE_UNDEFINED;
11591141
}
11601142
virtual ~MCRequest();
@@ -1290,7 +1272,6 @@ class MCEncryptionOp : public MCStatement
12901272
MCExpression *salt;
12911273
MCExpression *iv;
12921274
Boolean ispassword;
1293-
MCVarref *it;
12941275

12951276
bool is_rsa;
12961277
RSA_KEYTYPE rsa_keytype;
@@ -1302,7 +1283,6 @@ class MCEncryptionOp : public MCStatement
13021283
MCEncryptionOp()
13031284
{
13041285
source = ciphername = keystr = keylen = NULL;
1305-
it = NULL;
13061286
salt = NULL;
13071287
iv = NULL;
13081288
rsa_key = rsa_passphrase = NULL;
@@ -1441,7 +1421,6 @@ class MCRead : public MCStatement
14411421
File_unit unit;
14421422
MCExpression *maxwait;
14431423
Functions timeunits;
1444-
MCVarref *it;
14451424
MCExpression *at;
14461425
public:
14471426
MCRead()
@@ -1450,7 +1429,6 @@ class MCRead : public MCStatement
14501429
maxwait = NULL;
14511430
stop = NULL;
14521431
unit = FU_CHARACTER;
1453-
it = NULL;
14541432
at = NULL;
14551433
}
14561434
virtual ~MCRead();

0 commit comments

Comments
 (0)