parser: simplify constroctors of nodes
authorJean Privat <jean@pryen.org>
Thu, 22 Mar 2012 13:47:31 +0000 (09:47 -0400)
committerJean Privat <jean@pryen.org>
Tue, 10 Apr 2012 18:30:30 +0000 (14:30 -0400)
in parser_nodes, ANode has an empty constructor inherited by all subclasses

Signed-off-by: Jean Privat <jean@pryen.org>

src/parser/parser_nodes.nit
src/parser/parser_prod.nit
src/parser/xss/prods.xss

index 574e512..5e905e8 100644 (file)
@@ -29,6 +29,7 @@ abstract class ANode
        fun location: Location do return _location.as(not null)
        # The location of the important part of the node (identifier or whatever)
        fun hot_location: Location do return location
+       init do end
 end
 
 # Ancestor of all tokens
@@ -535,14 +536,12 @@ end
 class AConcreteInitPropdef
        super AConcreteMethPropdef
        super AInitPropdef
-    init do end
     readable var _n_kwinit: TKwinit
     redef fun hot_location do return n_kwinit.location
 end
 class AExternInitPropdef
        super AExternPropdef
        super AInitPropdef
-    init do end
     readable var _n_kwnew: TKwnew
 end
 class AMainMethPropdef
@@ -1184,4 +1183,9 @@ class Start
        super Prod
     readable var _n_base: nullable AModule
     readable var _n_eof: EOF
+    init(n_base: nullable AModule, n_eof: EOF)
+    do
+           self._n_base = n_base
+           self._n_eof = n_eof
+    end
 end
index 6899b21..d79eac9 100644 (file)
@@ -8347,14 +8347,6 @@ redef class ADoc
 end
 
 redef class Start
-    init(
-        n_base: nullable AModule,
-        n_eof: EOF)
-    do
-        _n_base = n_base
-        _n_eof = n_eof
-    end
-
     redef fun replace_child(old_child: ANode, new_child: nullable ANode)
     do
         if _n_base == old_child then
index 9f2b330..45a6868 100644 (file)
@@ -43,6 +43,14 @@ class Start
        super Prod
     readable var _n_base: nullable $baseprod
     readable var _n_eof: EOF
+    init(
+        n_base: nullable $baseprod,
+        n_eof: EOF)
+    do
+        _n_base = n_base
+        _n_eof = n_eof
+    end
+
 end
 $ end template
 
@@ -145,14 +153,6 @@ end
 $ end foreach
 
 redef class Start
-    init(
-        n_base: nullable $baseprod,
-        n_eof: EOF)
-    do
-        _n_base = n_base
-        _n_eof = n_eof
-    end
-
     redef fun replace_child(old_child: PNode, new_child: nullable PNode)
     do
         if _n_base == old_child then