Selaa lähdekoodia

lower L7: an empty procedure body is still a body

PROCEDURE P(...); BEGIN END P had astStmt = NoNode, which LowerDecls
reads as a definition-module heading and skips (no function emitted).
Block now marks an empty BEGIN...END with an empty NkBlock.

Suite 204/204; FIXPOINT OK (3,524,768 bytes).
Eric Streit 5 päivää sitten
vanhempi
commit
7613a86e8f
2 muutettua tiedostoa jossa 2596 lisäystä ja 2582 poistoa
  1. 8 1
      compiler/src/M2.atg
  2. 2588 2581
      compiler/src/M2.lst

+ 8 - 1
compiler/src/M2.atg

@@ -1286,7 +1286,14 @@ PRODUCTIONS
   Block<pn: SymTab.Name>                (. VAR m2: SymTab.Name; .)
   Block<pn: SymTab.Name>                (. VAR m2: SymTab.Name; .)
     = DeclSeq                           (. astBlkDecls := astDecl;
     = DeclSeq                           (. astBlkDecls := astDecl;
                                            astStmt := AST.NoNode; .)
                                            astStmt := AST.NoNode; .)
-      [ "BEGIN"
+      [ "BEGIN"                         (. (* an empty body is still a
+                                             body: mark it so Lower
+                                             does not read it as a
+                                             definition heading *)
+                                           IF astStmt = AST.NoNode THEN
+                                             astStmt :=
+                                               AST.MakeNode(AST.NkBlock)
+                                           END; .)
         [ StatSeq ] ]
         [ StatSeq ] ]
       "END"
       "END"
       GetIdent<m2>                      (. IF NOT SymTab.Equal(pn, m2) THEN
       GetIdent<m2>                      (. IF NOT SymTab.Equal(pn, m2) THEN

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2588 - 2581
compiler/src/M2.lst


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä