Răsfoiți Sursa

+ new parser-only node class to handle Delphi-mode inline specializations

git-svn-id: trunk@31588 -
svenbarth 10 ani în urmă
părinte
comite
4f5fc66298
2 a modificat fișierele cu 44 adăugiri și 2 ștergeri
  1. 40 0
      compiler/nbas.pas
  2. 4 2
      compiler/node.pas

+ 40 - 0
compiler/nbas.pas

@@ -48,6 +48,15 @@ interface
        end;
        terrornodeclass = class of terrornode;
 
+       tspecializenode = class(tunarynode)
+          sym:tsym;
+          getaddr:boolean;
+          constructor create(l:tnode;g:boolean;s:tsym);virtual;
+          function pass_1:tnode;override;
+          function pass_typecheck:tnode;override;
+       end;
+       tspecializenodeclass = class of tspecializenode;
+
        tasmnode = class(tnode)
           p_asm : TAsmList;
           currenttai : tai;
@@ -248,6 +257,7 @@ interface
     var
        cnothingnode : tnothingnodeclass = tnothingnode;
        cerrornode : terrornodeclass = terrornode;
+       cspecializenode : tspecializenodeclass = tspecializenode;
        casmnode : tasmnodeclass = tasmnode;
        cstatementnode : tstatementnodeclass = tstatementnode;
        cblocknode : tblocknodeclass = tblocknode;
@@ -379,6 +389,36 @@ implementation
       begin
       end;
 
+
+{*****************************************************************************
+                             TSPECIALIZENODE
+*****************************************************************************}
+
+    constructor tspecializenode.create(l:tnode;g:boolean;s:tsym);
+      begin
+         inherited create(specializen,l);
+         sym:=s;
+         getaddr:=g;
+      end;
+
+
+    function tspecializenode.pass_typecheck:tnode;
+      begin
+         result:=nil;
+         resultdef:=cundefinedtype;
+      end;
+
+
+    function tspecializenode.pass_1:tnode;
+      begin
+         { such a node should not reach pass_1 }
+         internalerror(2015071704);
+         result:=nil;
+         expectloc:=LOC_VOID;
+         codegenerror:=true;
+      end;
+
+
 {*****************************************************************************
                             TSTATEMENTNODE
 *****************************************************************************}

+ 4 - 2
compiler/node.pas

@@ -110,7 +110,8 @@ interface
           loadparentfpn,    { Load the framepointer of the parent for nested procedures }
           dataconstn,       { node storing some binary data }
           objcselectorn,    { node for an Objective-C message selector }
-          objcprotocoln     { node for an Objective-C @protocol() expression (returns metaclass associated with protocol) }
+          objcprotocoln,    { node for an Objective-C @protocol() expression (returns metaclass associated with protocol) }
+          specializen       { parser-only node to handle Delphi-mode inline specializations }
        );
 
        tnodetypeset = set of tnodetype;
@@ -194,7 +195,8 @@ interface
           'loadparentfpn',
           'dataconstn',
           'objcselectorn',
-          'objcprotocoln');
+          'objcprotocoln',
+          'specializen');
 
       { a set containing all const nodes }
       nodetype_const = [ordconstn,