소스 검색

* fixed more formal const problems

florian 21 년 전
부모
커밋
76782a514a
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      compiler/htypechk.pas

+ 8 - 4
compiler/htypechk.pas

@@ -157,7 +157,7 @@ implementation
        ;
 
     type
-      TValidAssign=(Valid_Property,Valid_Void);
+      TValidAssign=(Valid_Property,Valid_Void,Valid_Const);
       TValidAssigns=set of TValidAssign;
 
 
@@ -1029,7 +1029,7 @@ implementation
                        if (tvarsym(tloadnode(hp).symtableentry).varspez=vs_const) then
                         begin
                           { allow p^:= constructions with p is const parameter }
-                          if gotderef then
+                          if gotderef or (Valid_Const in opts) then
                            valid_for_assign:=true
                           else
                            CGMessagePos(tloadnode(hp).fileinfo,type_e_no_assign_to_const);
@@ -1088,7 +1088,8 @@ implementation
 
     function  valid_for_formal_const(p : tnode) : boolean;
       begin
-        valid_for_formal_const:=is_constnode(p) or is_procsym_load(p) or valid_for_assign(p,[valid_void]);
+        valid_for_formal_const:=is_constnode(p) or is_procsym_load(p) or (p.resulttype.def.deftype=formaldef) or
+          valid_for_assign(p,[valid_void,valid_const]);
       end;
 
 
@@ -1903,7 +1904,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.89  2004-05-24 20:39:41  florian
+  Revision 1.90  2004-05-24 21:04:31  florian
+    * fixed more formal const problems
+
+  Revision 1.89  2004/05/24 20:39:41  florian
     * stricter handling of formal const parameters and IE fixed
 
   Revision 1.88  2004/05/23 18:28:40  peter