浏览代码

* fixed ofs(procedure) as well

git-svn-id: trunk@32205 -
nickysn 9 年之前
父节点
当前提交
072139cdb7
共有 2 个文件被更改,包括 16 次插入4 次删除
  1. 9 0
      compiler/ngtcon.pas
  2. 7 4
      compiler/pexpr.pas

+ 9 - 0
compiler/ngtcon.pas

@@ -781,6 +781,15 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                 node:=hp;
               end;
         { allows horrible ofs(typeof(TButton)^) code !! }
+        if (node.nodetype=typeconvn) then
+          with Ttypeconvnode(node) do
+            if (left.nodetype=addrn) and equal_defs(uinttype,node.resultdef) then
+              begin
+                hp:=left;
+                left:=nil;
+                node.free;
+                node:=hp;
+              end;
         if (node.nodetype=addrn) then
           with Taddrnode(node) do
             if left.nodetype=derefn then

+ 7 - 4
compiler/pexpr.pas

@@ -599,12 +599,15 @@ implementation
               if target_info.system in systems_managed_vm then
                 message(parser_e_feature_unsupported_for_vm);
               consume(_LKLAMMER);
-              in_args:=true;
-              p1:=comp_expr(true,false);
+              got_addrn:=true;
+              p1:=factor(true,false,false);
+              { inside parentheses a full expression is allowed, see also tests\webtbs\tb27517.pp }
+              if token<>_RKLAMMER then
+                p1:=sub_expr(opcompare,true,false,p1);
               p1:=caddrnode.create(p1);
-              do_typecheckpass(p1);
+              got_addrn:=false;
               { Ofs() returns a cardinal/qword, not a pointer }
-              p1.resultdef:=uinttype;
+              inserttypeconv_internal(p1,uinttype);
               consume(_RKLAMMER);
               statement_syssym:=p1;
             end;