diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 60c200344c..6abdcdcf31 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -1581,7 +1581,6 @@ unit pdecl; pt1,pt2 : ptree; begin - p:=nil; { use of current parsed object ? } if (token=ID) and (testcurobject=2) and (curobjectname=pattern) then begin @@ -1742,6 +1741,7 @@ unit pdecl; end; begin + p:=nil; case token of _STRING,_FILE: p:=single_type(hs); @@ -1787,14 +1787,16 @@ unit pdecl; consume(_SET); consume(_OF); hp1:=read_type(''); - case hp1^.deftype of - { don't forget that min can be negativ PM } - enumdef : if penumdef(hp1)^.min>=0 then + if assigned(hp1) then + begin + case hp1^.deftype of + { don't forget that min can be negativ PM } + enumdef : if penumdef(hp1)^.min>=0 then p:=new(psetdef,init(hp1,penumdef(hp1)^.max)) - else + else Message(sym_e_ill_type_decl_set); - orddef : begin - case porddef(hp1)^.typ of + orddef : begin + case porddef(hp1)^.typ of uchar : p:=new(psetdef,init(hp1,255)); u8bit,s8bit,u16bit,s16bit,s32bit : begin @@ -1806,7 +1808,10 @@ unit pdecl; end; end; else Message(sym_e_ill_type_decl_set); - end; + end; + end + else + p:=generrordef; end; CARET: begin @@ -1879,6 +1884,8 @@ unit pdecl; else expr_type; end; + if p=nil then + p:=generrordef; read_type:=p; end; @@ -2048,7 +2055,10 @@ unit pdecl; end. { $Log$ - Revision 1.62 1998-10-02 17:06:02 peter + Revision 1.63 1998-10-05 13:57:13 peter + * crash preventions + + Revision 1.62 1998/10/02 17:06:02 peter * better error message for unresolved forward types Revision 1.61 1998/10/02 09:23:24 peter diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 4985bbeac6..0057b261d7 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -1031,16 +1031,10 @@ unit pexpr; while true do begin p1:=comp_expr(true); - do_firstpass(p1); - if codegenerror then - break; if token=POINTPOINT then begin consume(POINTPOINT); p2:=comp_expr(true); - do_firstpass(p2); - if codegenerror then - break; p1:=gennode(arrayconstructrangen,p1,p2); end; { insert at the end of the tree, to get the correct order } @@ -1093,7 +1087,27 @@ unit pexpr; begin { prevent crashes with unknown types } if not assigned(pd) then - exit; + begin + { try to recover } + repeat + case token of + CARET : consume(CARET); + POINT : begin + consume(POINT); + consume(ID); + end; + LECKKLAMMER : begin + repeat + consume(token); + until token in [RECKKLAMMER,SEMICOLON]; + end; + else + break; + end; + until false; + exit; + end; + { handle token } case token of CARET : begin consume(CARET); @@ -1329,8 +1343,12 @@ unit pexpr; consume(LKLAMMER); p1:=factor(false); if p1^.treetype<>typen then - Message(type_e_type_id_expected); - pd:=p1^.resulttype; + begin + Message(type_e_type_id_expected); + pd:=generrordef; + end + else + pd:=p1^.resulttype; pd2:=pd; if (pd^.deftype<>pointerdef) or (ppointerdef(pd)^.definition^.deftype<>objectdef) then @@ -1825,7 +1843,10 @@ unit pexpr; end. { $Log$ - Revision 1.60 1998-10-05 12:32:46 peter + Revision 1.61 1998-10-05 13:57:15 peter + * crash preventions + + Revision 1.60 1998/10/05 12:32:46 peter + assert() support Revision 1.59 1998/10/01 14:56:24 peter diff --git a/compiler/todo.txt b/compiler/todo.txt index 317a7fe486..cd176e9c20 100644 --- a/compiler/todo.txt +++ b/compiler/todo.txt @@ -50,30 +50,30 @@ compiler version and your short cut. - andn optimization - muladdn optimization - comparisations -- open strings -- $P -- range checking for open arrays -- array of const as subroutine parameter - - open array with call by value ............................ 0.99.6 (FK) - - subrange types of enumerations ........................... 0.99.7 (PFV) -- method pointers (procedure of object) - - code generation for exceptions ........................... 0.99.7 (FK) -- assertation -- sysutils unit for go32v2 (excpetions!) -- initialisation/finalization for units -- fixed data type - - add abstract virtual method runtime - error checking (210) ................................... 0.99.1 (FK) -- add alignment $A switch - - add debug info $D switch ............................... 0.99.1 (FK) - - add strict var strings check $V switch ................. 0.99.1 (FK) -- $B -- fix all bugs of the bug directory -- include/exclude - - make dec/inc internal................................... 0.99.6 (PFV) - - make length internal.................................... 0.99.7 (PFV) * Delphi 4 support - overloaded directive - default parameters - dynamic arrays - - 64 bit int \ No newline at end of file + - 64 bit int +* Misc + - array of const as subroutine parameter ................ 0.99.9 (PFV) + - open array with call by value ......................... 0.99.6 (FK) + - subrange types of enumerations ........................ 0.99.7 (PFV) + - code generation for exceptions ........................ 0.99.7 (FK) + - assertation ........................................... 0.99.9 (PFV) + - add abstract virtual method runtime error (210) ....... 0.99.1 (FK) + - add debug info $D switch .............................. 0.99.1 (FK) + - add strict var strings check $V switch ................ 0.99.1 (FK) + - make dec/inc internal.................................. 0.99.6 (PFV) + - make length internal................................... 0.99.7 (PFV) +- fix all bugs of the bug directory +- range checking for open arrays +- method pointers (procedure of object) +- sysutils unit for go32v2 (excpetions!) +- initialisation/finalization for units +- fixed data type +- add alignment $A switch +- $B +- open strings, $P +- include/exclude + \ No newline at end of file