From b193bf7df3ae1794dbd9383d53951dc6df0c9cc0 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 4 Apr 2001 22:43:50 +0000 Subject: [PATCH] * remove unnecessary calls to firstpass --- compiler/pdecl.pas | 7 ++++--- compiler/pdecobj.pas | 21 +++++++++++---------- compiler/pdecsub.pas | 8 ++++---- compiler/pdecvar.pas | 6 ++++-- compiler/pexports.pas | 7 ++++--- compiler/pexpr.pas | 19 ++++++------------- compiler/pstatmnt.pas | 7 ++++--- compiler/ptconst.pas | 27 +++++++++------------------ compiler/ptype.pas | 11 +++++++---- 9 files changed, 53 insertions(+), 60 deletions(-) diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 19bec33468..9a9aec9e1a 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -79,7 +79,6 @@ implementation internalerror(9584582); hp:=nil; p:=comp_expr(true); - do_firstpass(p); storetokenpos:=akttokenpos; akttokenpos:=filepos; case p.nodetype of @@ -508,7 +507,6 @@ implementation begin consume(_EQUAL); p:=comp_expr(true); - do_firstpass(p); storetokenpos:=akttokenpos; akttokenpos:=filepos; case p.nodetype of @@ -546,7 +544,10 @@ implementation end. { $Log$ - Revision 1.27 2001-04-04 21:30:43 florian + Revision 1.28 2001-04-04 22:43:50 peter + * remove unnecessary calls to firstpass + + Revision 1.27 2001/04/04 21:30:43 florian * applied several fixes to get the DD8 Delphi Unit compiled e.g. "forward"-interfaces are working now diff --git a/compiler/pdecobj.pas b/compiler/pdecobj.pas index a947270010..b511b130d3 100644 --- a/compiler/pdecobj.pas +++ b/compiler/pdecobj.pas @@ -124,8 +124,9 @@ implementation begin { check for a class } - if not((is_class_or_interface(aktclass)) or ((m_delphi in aktmodeswitches) and (is_object(aktclass)))) then {MvdV: Ozerski 14.03.01} - Message(parser_e_syntax_error); + if not((is_class_or_interface(aktclass)) or + ((m_delphi in aktmodeswitches) and (is_object(aktclass)))) then + Message(parser_e_syntax_error); consume(_PROPERTY); propertyparas:=TParaLinkedList.Create; datacoll:=nil; @@ -217,8 +218,8 @@ implementation begin consume(_INDEX); pt:=comp_expr(true); - do_firstpass(pt); - if is_ordinal(pt.resulttype.def) and + if is_constnode(pt) and + is_ordinal(pt.resulttype.def) and (not is_64bitint(pt.resulttype.def)) then p^.index:=tordconstnode(pt).value else @@ -453,15 +454,13 @@ implementation { Get the result of the default, the firstpass is needed to support values like -1 } pt:=comp_expr(true); - do_firstpass(pt); if (p^.proptype.def^.deftype=setdef) and (pt.nodetype=arrayconstructorn) then begin arrayconstructor_to_set(tarrayconstructornode(pt)); - do_firstpass(pt); + do_resulttypepass(pt); end; - pt:=ctypeconvnode.create(pt,p^.proptype); - do_firstpass(pt); + inserttypeconv(pt,p^.proptype); if not(is_constnode(pt)) then Message(parser_e_property_default_value_must_const); @@ -860,7 +859,6 @@ implementation p : tnode; begin p:=comp_expr(true); - do_firstpass(p); if p.nodetype=stringconstn then begin aktclass^.iidstr:=stringdup(strpas(tstringconstnode(p).value_str)); { or upper? } @@ -1169,7 +1167,10 @@ implementation end. { $Log$ - Revision 1.19 2001-04-04 21:30:43 florian + Revision 1.20 2001-04-04 22:43:51 peter + * remove unnecessary calls to firstpass + + Revision 1.19 2001/04/04 21:30:43 florian * applied several fixes to get the DD8 Delphi Unit compiled e.g. "forward"-interfaces are working now diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index 6867fc81ca..37a669cf4a 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -867,9 +867,7 @@ begin (token<>_SEMICOLON) then begin { any type of parameter is allowed here! } - pt:=comp_expr(true); - do_firstpass(pt); if is_constintnode(pt) then begin include(aktprocsym^.definition^.procoptions,po_msgint); @@ -912,7 +910,6 @@ begin (TParaItem(aktprocsym^.definition^.Para.first).paratyp<>vs_var)) then Message(parser_e_ill_msg_param); pt:=comp_expr(true); - do_firstpass(pt); if pt.nodetype=stringconstn then begin include(aktprocsym^.definition^.procoptions,po_msgstr); @@ -1889,7 +1886,10 @@ end; end. { $Log$ - Revision 1.16 2001-04-02 21:20:33 peter + Revision 1.17 2001-04-04 22:43:52 peter + * remove unnecessary calls to firstpass + + Revision 1.16 2001/04/02 21:20:33 peter * resulttype rewrite Revision 1.15 2001/03/24 12:18:11 florian diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 226d49c60a..e1ab8c9f88 100644 --- a/compiler/pdecvar.pas +++ b/compiler/pdecvar.pas @@ -477,7 +477,6 @@ implementation repeat repeat pt:=comp_expr(true); - do_firstpass(pt); if not(pt.nodetype=ordconstn) then Message(cg_e_illegal_expression); pt.free; @@ -530,7 +529,10 @@ implementation end. { $Log$ - Revision 1.13 2001-04-04 21:30:45 florian + Revision 1.14 2001-04-04 22:43:52 peter + * remove unnecessary calls to firstpass + + Revision 1.13 2001/04/04 21:30:45 florian * applied several fixes to get the DD8 Delphi Unit compiled e.g. "forward"-interfaces are working now diff --git a/compiler/pexports.pas b/compiler/pexports.pas index 1c53dba9b6..dc2f31a9c8 100644 --- a/compiler/pexports.pas +++ b/compiler/pexports.pas @@ -99,7 +99,6 @@ implementation begin consume(_INDEX); pt:=comp_expr(true); - do_firstpass(pt); if pt.nodetype=ordconstn then hp.index:=tordconstnode(pt).value else @@ -118,7 +117,6 @@ implementation begin consume(_NAME); pt:=comp_expr(true); - do_firstpass(pt); if pt.nodetype=stringconstn then hp.name:=stringdup(strpas(tstringconstnode(pt).value_str)) else @@ -165,7 +163,10 @@ end. { $Log$ - Revision 1.12 2001-03-11 22:58:50 peter + Revision 1.13 2001-04-04 22:43:52 peter + * remove unnecessary calls to firstpass + + Revision 1.12 2001/03/11 22:58:50 peter * getsym redesign, removed the globals srsym,srsymtable Revision 1.11 2001/01/03 13:12:50 jonas diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index c3c850ef1a..17b9f5e116 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -105,7 +105,6 @@ implementation begin consume(_LECKKLAMMER); p:=comp_expr(true); - do_firstpass(p); if not is_constintnode(p) then begin Message(cg_e_illegal_expression); @@ -245,11 +244,8 @@ implementation begin consume(_LKLAMMER); in_args:=true; - {allow_type:=true;} p1:=comp_expr(true); - {allow_type:=false;} consume(_RKLAMMER); - do_resulttypepass(p1); if p1.resulttype.def^.deftype=objectdef then statement_syssym:=geninlinenode(in_typeof_x,false,p1) else @@ -264,11 +260,8 @@ implementation begin consume(_LKLAMMER); in_args:=true; - {allow_type:=true;} p1:=comp_expr(true); - {allow_type:=false; } consume(_RKLAMMER); - do_resulttypepass(p1); if (p1.nodetype<>typen) and ( ((p1.resulttype.def^.deftype=objectdef) and @@ -309,7 +302,6 @@ implementation consume(_LKLAMMER); in_args:=true; p1:=comp_expr(true); - do_resulttypepass(p1); if not codegenerror then begin case p1.resulttype.def^.deftype of @@ -429,7 +421,6 @@ implementation while true do begin p1:=comp_expr(true); - do_resulttypepass(p1); set_varstate(p1,true); if not((p1.resulttype.def^.deftype=stringdef) or ((p1.resulttype.def^.deftype=orddef) and @@ -1377,7 +1368,8 @@ implementation while again do begin { we need the resulttype } - if do_resulttypepass(p1) then + do_resulttypepass(p1); + if codegenerror then begin recoverconsume_postfixops; exit; @@ -2288,7 +2280,6 @@ implementation p:tnode; begin p:=comp_expr(true); - do_firstpass(p); if not codegenerror then begin if (p.nodetype<>ordconstn) or @@ -2310,7 +2301,6 @@ implementation begin get_stringconst:=''; p:=comp_expr(true); - do_firstpass(p); if p.nodetype<>stringconstn then begin if (p.nodetype=ordconstn) and is_char(p.resulttype.def) then @@ -2326,7 +2316,10 @@ implementation end. { $Log$ - Revision 1.26 2001-04-02 21:20:33 peter + Revision 1.27 2001-04-04 22:43:52 peter + * remove unnecessary calls to firstpass + + Revision 1.26 2001/04/02 21:20:33 peter * resulttype rewrite Revision 1.25 2001/03/11 22:58:50 peter diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index 99a828ce32..7b3daf5493 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -223,8 +223,6 @@ implementation { may be an instruction has more case labels } repeat p:=expr; - cleartempgen; - do_firstpass(p); hl1:=0; hl2:=0; if (p.nodetype=rangen) then @@ -1226,7 +1224,10 @@ implementation end. { $Log$ - Revision 1.22 2001-04-02 21:20:34 peter + Revision 1.23 2001-04-04 22:43:52 peter + * remove unnecessary calls to firstpass + + Revision 1.22 2001/04/02 21:20:34 peter * resulttype rewrite Revision 1.21 2001/03/22 22:35:42 florian diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index b9f00f30d4..1254097395 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -104,7 +104,6 @@ implementation orddef: begin p:=comp_expr(true); - do_firstpass(p); case porddef(t.def)^.typ of bool8bit : begin @@ -195,7 +194,6 @@ implementation floatdef: begin p:=comp_expr(true); - do_firstpass(p); if is_constrealnode(p) then value:=trealconstnode(p).value_real else if is_constintnode(p) then @@ -220,7 +218,6 @@ implementation classrefdef: begin p:=comp_expr(true); - do_firstpass(p); case p.nodetype of loadvmtn: begin @@ -239,7 +236,6 @@ implementation pointerdef: begin p:=comp_expr(true); - do_firstpass(p); if (p.nodetype=typeconvn) and (ttypeconvnode(p).left.nodetype in [addrn,niln]) and is_equal(t.def,p.resulttype.def) then @@ -301,7 +297,7 @@ implementation (is_void(ppointerdef(t.def)^.pointertype.def))) and (hp.nodetype=loadn) then begin - do_firstpass(taddrnode(p).left); + do_resulttypepass(taddrnode(p).left); hp:=taddrnode(p).left; offset:=0; while assigned(hp) and (hp.nodetype<>loadn) do @@ -364,7 +360,6 @@ implementation setdef: begin p:=comp_expr(true); - do_firstpass(p); if p.nodetype=setconstn then begin { we only allow const sets } @@ -398,7 +393,6 @@ implementation enumdef: begin p:=comp_expr(true); - do_firstpass(p); if p.nodetype=ordconstn then begin if is_equal(p.resulttype.def,t.def) or @@ -420,7 +414,6 @@ implementation stringdef: begin p:=comp_expr(true); - do_firstpass(p); { load strval and strlength of the constant tree } if p.nodetype=stringconstn then begin @@ -533,7 +526,6 @@ implementation if is_char(parraydef(t.def)^.elementtype.def) then begin p:=comp_expr(true); - do_firstpass(p); if p.nodetype=stringconstn then begin len:=tstringconstnode(p).len; @@ -593,7 +585,6 @@ implementation getprocvardef:=pprocvardef(t.def); p:=comp_expr(true); getprocvar:=false; - do_firstpass(p); if codegenerror then begin p.free; @@ -607,7 +598,7 @@ implementation is_class(pdef(tcallnode(p).symtableprocentry^.owner^.defowner)) then tloadnode(hp).set_mp(tcallnode(p).methodpointer.getcopy); p.free; - do_firstpass(hp); + do_resulttypepass(hp); p:=hp; if codegenerror then begin @@ -624,7 +615,7 @@ implementation is_class(pdef(tcallnode(taddrnode(p).left).symtableprocentry^.owner^.defowner)) then tloadnode(hp).set_mp(tcallnode(taddrnode(p).left).methodpointer.getcopy); p.free; - do_firstpass(hp); + do_resulttypepass(hp); p:=hp; if codegenerror then begin @@ -633,8 +624,7 @@ implementation end; end; { let type conversion check everything needed } - p:=ctypeconvnode.create(p,t); - do_firstpass(p); + inserttypeconv(p,t); if codegenerror then begin p.free; @@ -676,8 +666,7 @@ implementation ((token=_CSTRING) or (token=_CCHAR) or (token=_ID)) then begin p:=comp_expr(true); - p:=ctypeconvnode.create(p,cshortstringtype); - do_firstpass(p); + inserttypeconv(p,cshortstringtype); if p.nodetype=stringconstn then begin s:=strpas(tstringconstnode(p).value_str); @@ -748,7 +737,6 @@ implementation if is_class_or_interface(t.def) then begin p:=comp_expr(true); - do_firstpass(p); if p.nodetype<>niln then begin Message(parser_e_type_const_not_possible); @@ -859,7 +847,10 @@ implementation end. { $Log$ - Revision 1.19 2001-04-02 21:20:34 peter + Revision 1.20 2001-04-04 22:43:53 peter + * remove unnecessary calls to firstpass + + Revision 1.19 2001/04/02 21:20:34 peter * resulttype rewrite Revision 1.18 2001/03/11 22:58:50 peter diff --git a/compiler/ptype.pas b/compiler/ptype.pas index fad64b3bcf..cbb6fd4f56 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -256,13 +256,13 @@ implementation end; { we can't accept a equal in type } pt1:=comp_expr(not(ignore_equal)); - do_firstpass(pt1); + do_resulttypepass(pt1); if (token=_POINTPOINT) then begin consume(_POINTPOINT); { get high value of range } pt2:=comp_expr(not(ignore_equal)); - do_firstpass(pt2); + do_resulttypepass(pt2); { both must be evaluated to constants now } if (pt1.nodetype=ordconstn) and (pt2.nodetype=ordconstn) then @@ -371,7 +371,7 @@ implementation setdefdecl(pt.resulttype) else begin - do_firstpass(pt); + do_resulttypepass(pt); if (pt.nodetype=rangen) then begin if (trangenode(pt).left.nodetype=ordconstn) and @@ -590,7 +590,10 @@ implementation end. { $Log$ - Revision 1.21 2001-04-02 21:20:34 peter + Revision 1.22 2001-04-04 22:43:53 peter + * remove unnecessary calls to firstpass + + Revision 1.21 2001/04/02 21:20:34 peter * resulttype rewrite Revision 1.20 2001/03/22 22:35:42 florian