From be7df58a7fbeb70979b903b2832747699348fd9e Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Sat, 27 Dec 2008 15:12:19 -0500 Subject: [PATCH] Prepare Nit code for inherited and automatic constructors. All components are impacted (stdlib, compiler and tests). Changes concern: * attribute default values * constructor namies * class kind * redef keyword --- lib/standard/abstract_collection.nit | 2 +- lib/standard/array.nit | 4 +- lib/standard/exec.nit | 12 +- lib/standard/file.nit | 10 +- lib/standard/hash.nit | 2 +- lib/standard/stream.nit | 11 +- src/compiling/compiling_global.nit | 2 +- src/metamodel/static_type.nit | 2 +- src/nitdoc.nit | 2 +- src/parser/lexer.nit | 332 +++++++++++++++--------------- src/parser/parser_abs.nit | 2 + src/parser/parser_nodes.nit | 370 +++++++++++++++++----------------- src/parser/parser_prod.nit | 119 +++++++++++ src/parser/xss/lexer.xss | 4 +- src/parser/xss/prods.xss | 1 + src/parser/xss/tokens.xss | 6 +- tests/base_attr.nit | 2 +- tests/base_attr_def.nit | 2 +- tests/base_classid.nit | 4 +- tests/base_eq.nit | 2 +- tests/base_gen.nit | 2 +- tests/base_init_linext2.nit | 10 +- tests/base_isa.nit | 2 +- tests/base_primitive.nit | 2 +- tests/base_simple.nit | 2 +- tests/base_simple2.nit | 2 +- tests/base_virtual_type.nit | 2 +- tests/base_virtual_type2.nit | 2 +- tests/bench_complex_sort.nit | 20 +- tests/bench_netsim.nit | 8 +- tests/bench_send.nit | 6 +- tests/bench_send2.nit | 10 +- tests/example_objet.nit | 4 +- tests/sav/base_init_linext2_alt1.sav | 2 +- tests/sav/base_init_linext2_alt4.sav | 4 +- tests/sav/base_init_linext2_alt5.sav | 2 +- 36 files changed, 550 insertions(+), 421 deletions(-) diff --git a/lib/standard/abstract_collection.nit b/lib/standard/abstract_collection.nit index a1ad3f8..2ece03d 100644 --- a/lib/standard/abstract_collection.nit +++ b/lib/standard/abstract_collection.nit @@ -360,7 +360,7 @@ special MapIterator[Int, E] end # Associatives arrays that internally uses couples to represent each (key, value) pairs. -class CoupleMap[K, E] +interface CoupleMap[K, E] special Map[K, E] # Return the couple of the corresponding key # Return null if the key is no associated element diff --git a/lib/standard/array.nit b/lib/standard/array.nit index 5c63068..47933dc 100644 --- a/lib/standard/array.nit +++ b/lib/standard/array.nit @@ -301,10 +301,10 @@ special ArrayCapable[E] end # The internal storage. - attr _items: NativeArray[E] + attr _items: NativeArray[E] = null # The size of `_items'. - attr _capacity: Int + attr _capacity: Int = 0 end # An `Iterator' on `AbstractArray' diff --git a/lib/standard/exec.nit b/lib/standard/exec.nit index 171f3e9..c98a39c 100644 --- a/lib/standard/exec.nit +++ b/lib/standard/exec.nit @@ -90,13 +90,13 @@ special IStream redef meth eof do return _in.eof - redef init(command: String, arguments: String...) + init(command: String, arguments: String...) do execute(command, arguments, 2) _in = new FDIStream(_data.out_fd) end - redef init init_(command: String) + init init_(command: String) do execute(command, null, 2) _in = new FDIStream(_data.out_fd) @@ -115,13 +115,13 @@ special OStream redef meth write(s) do _out.write(s) - redef init(command: String, arguments: String...) + init(command: String, arguments: String...) do execute(command, arguments, 1) _out = new FDOStream(_data.in_fd) end - redef init init_(command: String) + init init_(command: String) do execute(command, null, 1) _out = new FDOStream(_data.in_fd) @@ -140,14 +140,14 @@ special IOStream _out.close end - redef init(command: String, arguments: String...) + init(command: String, arguments: String...) do execute(command, arguments, 3) _in = new FDIStream(_data.out_fd) _out = new FDOStream(_data.in_fd) end - redef init init_(command: String) + init init_(command: String) do execute(command, null, 3) _in = new FDIStream(_data.out_fd) diff --git a/lib/standard/file.nit b/lib/standard/file.nit index 5390293..2bc580e 100644 --- a/lib/standard/file.nit +++ b/lib/standard/file.nit @@ -55,10 +55,10 @@ special IOS special NativeFileCapable # The path of the file. - readable attr _path: String + readable attr _path: String = null # The FILE *. - attr _file: NativeFile + attr _file: NativeFile = null meth file_stat: FileStat do return _file.file_stat end @@ -98,7 +98,7 @@ special BufferedIStream end # End of file? - redef readable attr _end_reached: Bool + redef readable attr _end_reached: Bool = false # Open the file at `path' for reading. init open(path: String) @@ -109,6 +109,7 @@ special BufferedIStream assert cant_open_file: _file != null end + private init do end private init without_file do end end @@ -155,6 +156,7 @@ special OStream _writable = true end + private init do end private init without_file do end end @@ -277,7 +279,7 @@ special Pointer meth file_stat: FileStat is extern "file_NativeFile_NativeFile_file_stat_0" end -private class NativeFileCapable +private interface NativeFileCapable meth io_open_read(path: NativeString): NativeFile is extern "file_NativeFileCapable_NativeFileCapable_io_open_read_1" meth io_open_write(path: NativeString): NativeFile is extern "file_NativeFileCapable_NativeFileCapable_io_open_write_1" meth native_stdin: NativeFile is extern "file_NativeFileCapable_NativeFileCapable_native_stdin_0" diff --git a/lib/standard/hash.nit b/lib/standard/hash.nit index 21331e5..9d68891 100644 --- a/lib/standard/hash.nit +++ b/lib/standard/hash.nit @@ -319,7 +319,7 @@ special HashNode[K] redef meth key do return first redef type N: HashMapNode[K, V] - redef init(k: K, v: V) + init(k: K, v: V) do first = k second = v diff --git a/lib/standard/stream.nit b/lib/standard/stream.nit index f93a17b..f327d59 100644 --- a/lib/standard/stream.nit +++ b/lib/standard/stream.nit @@ -184,10 +184,10 @@ special IStream redef meth eof do return _buffer_pos >= _buffer.length and end_reached # The buffer - attr _buffer: String + attr _buffer: String = null # The current position in the buffer - attr _buffer_pos: Int + attr _buffer_pos: Int = 0 # Fill the buffer protected meth fill_buffer is abstract @@ -237,7 +237,7 @@ special IStream return nb end - redef init(fd: Int) do super + init(fd: Int) do end end class FDOStream @@ -251,9 +251,8 @@ special OStream if nb < s.length then _is_writable = false end - redef init(fd: Int) + init(fd: Int) do - super _is_writable = true end end @@ -262,7 +261,7 @@ class FDIOStream special FDIStream special FDOStream special IOStream - redef init(fd: Int) + init(fd: Int) do _fd = fd _is_writable = true diff --git a/src/compiling/compiling_global.nit b/src/compiling/compiling_global.nit index 6eb0998..b2c6931 100644 --- a/src/compiling/compiling_global.nit +++ b/src/compiling/compiling_global.nit @@ -23,7 +23,7 @@ private import syntax # Something that store color of table elements class ColorContext - attr _colors: HashMap[TableElt, Int] + attr _colors: HashMap[TableElt, Int] = null # The color of a table element. meth color(e: TableElt): Int diff --git a/src/metamodel/static_type.nit b/src/metamodel/static_type.nit index 2720fa4..8109d17 100644 --- a/src/metamodel/static_type.nit +++ b/src/metamodel/static_type.nit @@ -280,7 +280,7 @@ special MMTypeClass redef meth adapt_to(recv) do return self - redef init(c: MMLocalClass) + init(c: MMLocalClass) do super(c) end diff --git a/src/nitdoc.nit b/src/nitdoc.nit index 0fc787f..46cd1ed 100644 --- a/src/nitdoc.nit +++ b/src/nitdoc.nit @@ -243,7 +243,7 @@ special AbstractCompiler self.extract_other_doc end - redef init + init do super option_context.add_option(opt_dir) diff --git a/src/parser/lexer.nit b/src/parser/lexer.nit index 5556ca7..2ac066c 100644 --- a/src/parser/lexer.nit +++ b/src/parser/lexer.nit @@ -23,7 +23,7 @@ redef class TEol return 0 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -38,7 +38,7 @@ redef class TComment return 1 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -53,7 +53,7 @@ redef class TKwpackage return 2 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "package" _filename = fname @@ -68,7 +68,7 @@ redef class TKwimport return 3 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "import" _filename = fname @@ -83,7 +83,7 @@ redef class TKwclass return 4 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "class" _filename = fname @@ -98,7 +98,7 @@ redef class TKwabstract return 5 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "abstract" _filename = fname @@ -113,7 +113,7 @@ redef class TKwinterface return 6 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "interface" _filename = fname @@ -128,7 +128,7 @@ redef class TKwuniversal return 7 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "universal" _filename = fname @@ -143,7 +143,7 @@ redef class TKwspecial return 8 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "special" _filename = fname @@ -158,7 +158,7 @@ redef class TKwend return 9 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "end" _filename = fname @@ -173,7 +173,7 @@ redef class TKwmeth return 10 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "meth" _filename = fname @@ -188,7 +188,7 @@ redef class TKwtype return 11 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "type" _filename = fname @@ -203,7 +203,7 @@ redef class TKwattr return 12 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "attr" _filename = fname @@ -218,7 +218,7 @@ redef class TKwinit return 13 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "init" _filename = fname @@ -233,7 +233,7 @@ redef class TKwredef return 14 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "redef" _filename = fname @@ -248,7 +248,7 @@ redef class TKwis return 15 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "is" _filename = fname @@ -263,7 +263,7 @@ redef class TKwdo return 16 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "do" _filename = fname @@ -278,7 +278,7 @@ redef class TKwreadable return 17 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "readable" _filename = fname @@ -293,7 +293,7 @@ redef class TKwwritable return 18 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "writable" _filename = fname @@ -308,7 +308,7 @@ redef class TKwvar return 19 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "var" _filename = fname @@ -323,7 +323,7 @@ redef class TKwintern return 20 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "intern" _filename = fname @@ -338,7 +338,7 @@ redef class TKwextern return 21 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "extern" _filename = fname @@ -353,7 +353,7 @@ redef class TKwprotected return 22 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "protected" _filename = fname @@ -368,7 +368,7 @@ redef class TKwprivate return 23 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "private" _filename = fname @@ -383,7 +383,7 @@ redef class TKwintrude return 24 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "intrude" _filename = fname @@ -398,7 +398,7 @@ redef class TKwif return 25 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "if" _filename = fname @@ -413,7 +413,7 @@ redef class TKwthen return 26 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "then" _filename = fname @@ -428,7 +428,7 @@ redef class TKwelse return 27 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "else" _filename = fname @@ -443,7 +443,7 @@ redef class TKwwhile return 28 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "while" _filename = fname @@ -458,7 +458,7 @@ redef class TKwfor return 29 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "for" _filename = fname @@ -473,7 +473,7 @@ redef class TKwin return 30 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "in" _filename = fname @@ -488,7 +488,7 @@ redef class TKwand return 31 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "and" _filename = fname @@ -503,7 +503,7 @@ redef class TKwor return 32 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "or" _filename = fname @@ -518,7 +518,7 @@ redef class TKwnot return 33 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "not" _filename = fname @@ -533,7 +533,7 @@ redef class TKwreturn return 34 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "return" _filename = fname @@ -548,7 +548,7 @@ redef class TKwcontinue return 35 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "continue" _filename = fname @@ -563,7 +563,7 @@ redef class TKwbreak return 36 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "break" _filename = fname @@ -578,7 +578,7 @@ redef class TKwabort return 37 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "abort" _filename = fname @@ -593,7 +593,7 @@ redef class TKwassert return 38 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "assert" _filename = fname @@ -608,7 +608,7 @@ redef class TKwnew return 39 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "new" _filename = fname @@ -623,7 +623,7 @@ redef class TKwisa return 40 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "isa" _filename = fname @@ -638,7 +638,7 @@ redef class TKwonce return 41 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "once" _filename = fname @@ -653,7 +653,7 @@ redef class TKwsuper return 42 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "super" _filename = fname @@ -668,7 +668,7 @@ redef class TKwself return 43 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "self" _filename = fname @@ -683,7 +683,7 @@ redef class TKwtrue return 44 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "true" _filename = fname @@ -698,7 +698,7 @@ redef class TKwfalse return 45 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "false" _filename = fname @@ -713,7 +713,7 @@ redef class TKwnull return 46 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "null" _filename = fname @@ -728,7 +728,7 @@ redef class TKwas return 47 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "as" _filename = fname @@ -743,7 +743,7 @@ redef class TOpar return 48 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "(" _filename = fname @@ -758,7 +758,7 @@ redef class TCpar return 49 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once ")" _filename = fname @@ -773,7 +773,7 @@ redef class TObra return 50 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "[" _filename = fname @@ -788,7 +788,7 @@ redef class TCbra return 51 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "]" _filename = fname @@ -803,7 +803,7 @@ redef class TComma return 52 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "," _filename = fname @@ -818,7 +818,7 @@ redef class TColumn return 53 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once ":" _filename = fname @@ -833,7 +833,7 @@ redef class TQuad return 54 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "::" _filename = fname @@ -848,7 +848,7 @@ redef class TAssign return 55 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "=" _filename = fname @@ -863,7 +863,7 @@ redef class TPluseq return 56 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "+=" _filename = fname @@ -878,7 +878,7 @@ redef class TMinuseq return 57 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "-=" _filename = fname @@ -893,7 +893,7 @@ redef class TDotdotdot return 58 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "..." _filename = fname @@ -908,7 +908,7 @@ redef class TDotdot return 59 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once ".." _filename = fname @@ -923,7 +923,7 @@ redef class TDot return 60 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "." _filename = fname @@ -938,7 +938,7 @@ redef class TPlus return 61 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "+" _filename = fname @@ -953,7 +953,7 @@ redef class TMinus return 62 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "-" _filename = fname @@ -968,7 +968,7 @@ redef class TStar return 63 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "*" _filename = fname @@ -983,7 +983,7 @@ redef class TSlash return 64 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "/" _filename = fname @@ -998,7 +998,7 @@ redef class TPercent return 65 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "%" _filename = fname @@ -1013,7 +1013,7 @@ redef class TEq return 66 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "==" _filename = fname @@ -1028,7 +1028,7 @@ redef class TNe return 67 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "!=" _filename = fname @@ -1043,7 +1043,7 @@ redef class TLt return 68 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "<" _filename = fname @@ -1058,7 +1058,7 @@ redef class TLe return 69 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "<=" _filename = fname @@ -1073,7 +1073,7 @@ redef class TGt return 70 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once ">" _filename = fname @@ -1088,7 +1088,7 @@ redef class TGe return 71 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once ">=" _filename = fname @@ -1103,7 +1103,7 @@ redef class TStarship return 72 end - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "<=>" _filename = fname @@ -1118,7 +1118,7 @@ redef class TClassid return 73 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1133,7 +1133,7 @@ redef class TId return 74 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1148,7 +1148,7 @@ redef class TAttrid return 75 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1163,7 +1163,7 @@ redef class TNumber return 76 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1178,7 +1178,7 @@ redef class TFloat return 77 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1193,7 +1193,7 @@ redef class TChar return 78 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1208,7 +1208,7 @@ redef class TString return 79 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1223,7 +1223,7 @@ redef class TStartString return 80 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1238,7 +1238,7 @@ redef class TMidString return 81 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1253,7 +1253,7 @@ redef class TEndString return 82 end - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text _filename = fname @@ -1450,7 +1450,7 @@ class Lexer end if accept_token == 1 then var token_text = _text.substring(0, accept_length) - var token = new TEol(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TEol.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -1458,504 +1458,504 @@ class Lexer end if accept_token == 2 then var token_text = _text.substring(0, accept_length) - var token = new TComment(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TComment.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 3 then - var token = new TKwpackage(_filename, start_line + 1, start_pos + 1) + var token = new TKwpackage.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 4 then - var token = new TKwimport(_filename, start_line + 1, start_pos + 1) + var token = new TKwimport.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 5 then - var token = new TKwclass(_filename, start_line + 1, start_pos + 1) + var token = new TKwclass.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 6 then - var token = new TKwabstract(_filename, start_line + 1, start_pos + 1) + var token = new TKwabstract.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 7 then - var token = new TKwinterface(_filename, start_line + 1, start_pos + 1) + var token = new TKwinterface.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 8 then - var token = new TKwuniversal(_filename, start_line + 1, start_pos + 1) + var token = new TKwuniversal.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 9 then - var token = new TKwspecial(_filename, start_line + 1, start_pos + 1) + var token = new TKwspecial.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 10 then - var token = new TKwend(_filename, start_line + 1, start_pos + 1) + var token = new TKwend.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 11 then - var token = new TKwmeth(_filename, start_line + 1, start_pos + 1) + var token = new TKwmeth.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 12 then - var token = new TKwtype(_filename, start_line + 1, start_pos + 1) + var token = new TKwtype.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 13 then - var token = new TKwattr(_filename, start_line + 1, start_pos + 1) + var token = new TKwattr.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 14 then - var token = new TKwinit(_filename, start_line + 1, start_pos + 1) + var token = new TKwinit.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 15 then - var token = new TKwredef(_filename, start_line + 1, start_pos + 1) + var token = new TKwredef.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 16 then - var token = new TKwis(_filename, start_line + 1, start_pos + 1) + var token = new TKwis.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 17 then - var token = new TKwdo(_filename, start_line + 1, start_pos + 1) + var token = new TKwdo.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 18 then - var token = new TKwreadable(_filename, start_line + 1, start_pos + 1) + var token = new TKwreadable.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 19 then - var token = new TKwwritable(_filename, start_line + 1, start_pos + 1) + var token = new TKwwritable.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 20 then - var token = new TKwvar(_filename, start_line + 1, start_pos + 1) + var token = new TKwvar.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 21 then - var token = new TKwintern(_filename, start_line + 1, start_pos + 1) + var token = new TKwintern.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 22 then - var token = new TKwextern(_filename, start_line + 1, start_pos + 1) + var token = new TKwextern.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 23 then - var token = new TKwprotected(_filename, start_line + 1, start_pos + 1) + var token = new TKwprotected.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 24 then - var token = new TKwprivate(_filename, start_line + 1, start_pos + 1) + var token = new TKwprivate.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 25 then - var token = new TKwintrude(_filename, start_line + 1, start_pos + 1) + var token = new TKwintrude.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 26 then - var token = new TKwif(_filename, start_line + 1, start_pos + 1) + var token = new TKwif.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 27 then - var token = new TKwthen(_filename, start_line + 1, start_pos + 1) + var token = new TKwthen.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 28 then - var token = new TKwelse(_filename, start_line + 1, start_pos + 1) + var token = new TKwelse.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 29 then - var token = new TKwwhile(_filename, start_line + 1, start_pos + 1) + var token = new TKwwhile.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 30 then - var token = new TKwfor(_filename, start_line + 1, start_pos + 1) + var token = new TKwfor.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 31 then - var token = new TKwin(_filename, start_line + 1, start_pos + 1) + var token = new TKwin.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 32 then - var token = new TKwand(_filename, start_line + 1, start_pos + 1) + var token = new TKwand.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 33 then - var token = new TKwor(_filename, start_line + 1, start_pos + 1) + var token = new TKwor.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 34 then - var token = new TKwnot(_filename, start_line + 1, start_pos + 1) + var token = new TKwnot.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 35 then - var token = new TKwreturn(_filename, start_line + 1, start_pos + 1) + var token = new TKwreturn.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 36 then - var token = new TKwcontinue(_filename, start_line + 1, start_pos + 1) + var token = new TKwcontinue.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 37 then - var token = new TKwbreak(_filename, start_line + 1, start_pos + 1) + var token = new TKwbreak.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 38 then - var token = new TKwabort(_filename, start_line + 1, start_pos + 1) + var token = new TKwabort.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 39 then - var token = new TKwassert(_filename, start_line + 1, start_pos + 1) + var token = new TKwassert.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 40 then - var token = new TKwnew(_filename, start_line + 1, start_pos + 1) + var token = new TKwnew.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 41 then - var token = new TKwisa(_filename, start_line + 1, start_pos + 1) + var token = new TKwisa.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 42 then - var token = new TKwonce(_filename, start_line + 1, start_pos + 1) + var token = new TKwonce.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 43 then - var token = new TKwsuper(_filename, start_line + 1, start_pos + 1) + var token = new TKwsuper.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 44 then - var token = new TKwself(_filename, start_line + 1, start_pos + 1) + var token = new TKwself.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 45 then - var token = new TKwtrue(_filename, start_line + 1, start_pos + 1) + var token = new TKwtrue.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 46 then - var token = new TKwfalse(_filename, start_line + 1, start_pos + 1) + var token = new TKwfalse.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 47 then - var token = new TKwnull(_filename, start_line + 1, start_pos + 1) + var token = new TKwnull.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 48 then - var token = new TKwas(_filename, start_line + 1, start_pos + 1) + var token = new TKwas.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 49 then - var token = new TOpar(_filename, start_line + 1, start_pos + 1) + var token = new TOpar.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 50 then - var token = new TCpar(_filename, start_line + 1, start_pos + 1) + var token = new TCpar.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 51 then - var token = new TObra(_filename, start_line + 1, start_pos + 1) + var token = new TObra.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 52 then - var token = new TCbra(_filename, start_line + 1, start_pos + 1) + var token = new TCbra.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 53 then - var token = new TComma(_filename, start_line + 1, start_pos + 1) + var token = new TComma.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 54 then - var token = new TColumn(_filename, start_line + 1, start_pos + 1) + var token = new TColumn.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 55 then - var token = new TQuad(_filename, start_line + 1, start_pos + 1) + var token = new TQuad.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 56 then - var token = new TAssign(_filename, start_line + 1, start_pos + 1) + var token = new TAssign.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 57 then - var token = new TPluseq(_filename, start_line + 1, start_pos + 1) + var token = new TPluseq.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 58 then - var token = new TMinuseq(_filename, start_line + 1, start_pos + 1) + var token = new TMinuseq.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 59 then - var token = new TDotdotdot(_filename, start_line + 1, start_pos + 1) + var token = new TDotdotdot.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 60 then - var token = new TDotdot(_filename, start_line + 1, start_pos + 1) + var token = new TDotdot.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 61 then - var token = new TDot(_filename, start_line + 1, start_pos + 1) + var token = new TDot.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 62 then - var token = new TPlus(_filename, start_line + 1, start_pos + 1) + var token = new TPlus.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 63 then - var token = new TMinus(_filename, start_line + 1, start_pos + 1) + var token = new TMinus.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 64 then - var token = new TStar(_filename, start_line + 1, start_pos + 1) + var token = new TStar.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 65 then - var token = new TSlash(_filename, start_line + 1, start_pos + 1) + var token = new TSlash.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 66 then - var token = new TPercent(_filename, start_line + 1, start_pos + 1) + var token = new TPercent.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 67 then - var token = new TEq(_filename, start_line + 1, start_pos + 1) + var token = new TEq.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 68 then - var token = new TNe(_filename, start_line + 1, start_pos + 1) + var token = new TNe.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 69 then - var token = new TLt(_filename, start_line + 1, start_pos + 1) + var token = new TLt.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 70 then - var token = new TLe(_filename, start_line + 1, start_pos + 1) + var token = new TLe.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 71 then - var token = new TGt(_filename, start_line + 1, start_pos + 1) + var token = new TGt.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 72 then - var token = new TGe(_filename, start_line + 1, start_pos + 1) + var token = new TGe.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line return token end if accept_token == 73 then - var token = new TStarship(_filename, start_line + 1, start_pos + 1) + var token = new TStarship.init_tk(_filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -1963,7 +1963,7 @@ class Lexer end if accept_token == 74 then var token_text = _text.substring(0, accept_length) - var token = new TClassid(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TClassid.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -1971,7 +1971,7 @@ class Lexer end if accept_token == 75 then var token_text = _text.substring(0, accept_length) - var token = new TId(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TId.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -1979,7 +1979,7 @@ class Lexer end if accept_token == 76 then var token_text = _text.substring(0, accept_length) - var token = new TAttrid(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TAttrid.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -1987,7 +1987,7 @@ class Lexer end if accept_token == 77 then var token_text = _text.substring(0, accept_length) - var token = new TNumber(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TNumber.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -1995,7 +1995,7 @@ class Lexer end if accept_token == 78 then var token_text = _text.substring(0, accept_length) - var token = new TFloat(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TFloat.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -2003,7 +2003,7 @@ class Lexer end if accept_token == 79 then var token_text = _text.substring(0, accept_length) - var token = new TChar(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TChar.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -2011,7 +2011,7 @@ class Lexer end if accept_token == 80 then var token_text = _text.substring(0, accept_length) - var token = new TString(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TString.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -2019,7 +2019,7 @@ class Lexer end if accept_token == 81 then var token_text = _text.substring(0, accept_length) - var token = new TStartString(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TStartString.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -2027,7 +2027,7 @@ class Lexer end if accept_token == 82 then var token_text = _text.substring(0, accept_length) - var token = new TMidString(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TMidString.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line @@ -2035,7 +2035,7 @@ class Lexer end if accept_token == 83 then var token_text = _text.substring(0, accept_length) - var token = new TEndString(token_text, _filename, start_line + 1, start_pos + 1) + var token = new TEndString.init_tk(token_text, _filename, start_line + 1, start_pos + 1) push_back(accept_length) _pos = accept_pos _line = accept_line diff --git a/src/parser/parser_abs.nit b/src/parser/parser_abs.nit index 2c5e711..9d3e9ef 100644 --- a/src/parser/parser_abs.nit +++ b/src/parser/parser_abs.nit @@ -266,9 +266,11 @@ special Token end class EOF special Token +private init noinit do end end class PError special EOF +private init noinit do end end class PModule special Prod end diff --git a/src/parser/parser_nodes.nit b/src/parser/parser_nodes.nit index ef12c30..c77a193 100644 --- a/src/parser/parser_nodes.nit +++ b/src/parser/parser_nodes.nit @@ -266,9 +266,11 @@ special Token end class EOF special Token +private init noinit do end end class PError special EOF +private init noinit do end end class PModule special Prod end @@ -280,17 +282,17 @@ class PClasskind special Prod end class PFormaldef special Prod end class PSuperclass special Prod end class PPropdef special Prod - readable writable attr _n_doc: PDoc + readable writable attr _n_doc: PDoc = null end class PAble special Prod - readable writable attr _n_kwredef: TKwredef + readable writable attr _n_kwredef: TKwredef = null end class PMethid special Prod end class PSignature special Prod end class PParam special Prod - readable writable attr _n_id: TId - readable writable attr _n_type: PType + readable writable attr _n_id: TId = null + readable writable attr _n_type: PType = null end class PType special Prod end class PExpr special Prod end @@ -300,355 +302,355 @@ class PDoc special Prod end class AModule special PModule - readable writable attr _n_packagedecl: PPackagedecl - readable writable attr _n_imports: List[PImport] - readable writable attr _n_classdefs: List[PClassdef] + readable writable attr _n_packagedecl: PPackagedecl = null + readable writable attr _n_imports: List[PImport] = null + readable writable attr _n_classdefs: List[PClassdef] = null end class APackagedecl special PPackagedecl - readable writable attr _n_doc: PDoc - readable writable attr _n_kwpackage: TKwpackage - readable writable attr _n_id: TId + readable writable attr _n_doc: PDoc = null + readable writable attr _n_kwpackage: TKwpackage = null + readable writable attr _n_id: TId = null end class AImport special PImport - readable writable attr _n_visibility: PVisibility - readable writable attr _n_kwimport: TKwimport - readable writable attr _n_id: TId + readable writable attr _n_visibility: PVisibility = null + readable writable attr _n_kwimport: TKwimport = null + readable writable attr _n_id: TId = null end class ANoImport special PImport - readable writable attr _n_visibility: PVisibility - readable writable attr _n_kwimport: TKwimport - readable writable attr _n_kwend: TKwend + readable writable attr _n_visibility: PVisibility = null + readable writable attr _n_kwimport: TKwimport = null + readable writable attr _n_kwend: TKwend = null end class APublicVisibility special PVisibility end class APrivateVisibility special PVisibility - readable writable attr _n_kwprivate: TKwprivate + readable writable attr _n_kwprivate: TKwprivate = null end class AProtectedVisibility special PVisibility - readable writable attr _n_kwprotected: TKwprotected + readable writable attr _n_kwprotected: TKwprotected = null end class AIntrudeVisibility special PVisibility - readable writable attr _n_kwintrude: TKwintrude + readable writable attr _n_kwintrude: TKwintrude = null end class AClassdef special PClassdef - readable writable attr _n_doc: PDoc - readable writable attr _n_kwredef: TKwredef - readable writable attr _n_visibility: PVisibility - readable writable attr _n_classkind: PClasskind - readable writable attr _n_id: TClassid - readable writable attr _n_formaldefs: List[PFormaldef] - readable writable attr _n_superclasses: List[PSuperclass] - readable writable attr _n_propdefs: List[PPropdef] + readable writable attr _n_doc: PDoc = null + readable writable attr _n_kwredef: TKwredef = null + readable writable attr _n_visibility: PVisibility = null + readable writable attr _n_classkind: PClasskind = null + readable writable attr _n_id: TClassid = null + readable writable attr _n_formaldefs: List[PFormaldef] = null + readable writable attr _n_superclasses: List[PSuperclass] = null + readable writable attr _n_propdefs: List[PPropdef] = null end class ATopClassdef special PClassdef - readable writable attr _n_propdefs: List[PPropdef] + readable writable attr _n_propdefs: List[PPropdef] = null end class AMainClassdef special PClassdef - readable writable attr _n_propdefs: List[PPropdef] + readable writable attr _n_propdefs: List[PPropdef] = null end class AConcreteClasskind special PClasskind - readable writable attr _n_kwclass: TKwclass + readable writable attr _n_kwclass: TKwclass = null end class AAbstractClasskind special PClasskind - readable writable attr _n_kwabstract: TKwabstract - readable writable attr _n_kwclass: TKwclass + readable writable attr _n_kwabstract: TKwabstract = null + readable writable attr _n_kwclass: TKwclass = null end class AInterfaceClasskind special PClasskind - readable writable attr _n_kwinterface: TKwinterface + readable writable attr _n_kwinterface: TKwinterface = null end class AUniversalClasskind special PClasskind - readable writable attr _n_kwuniversal: TKwuniversal + readable writable attr _n_kwuniversal: TKwuniversal = null end class AFormaldef special PFormaldef - readable writable attr _n_id: TClassid - readable writable attr _n_type: PType + readable writable attr _n_id: TClassid = null + readable writable attr _n_type: PType = null end class ASuperclass special PSuperclass - readable writable attr _n_kwspecial: TKwspecial - readable writable attr _n_type: PType + readable writable attr _n_kwspecial: TKwspecial = null + readable writable attr _n_type: PType = null end class AAttrPropdef special PPropdef - readable writable attr _n_kwredef: TKwredef - readable writable attr _n_visibility: PVisibility - readable writable attr _n_kwattr: TKwattr - readable writable attr _n_id: TAttrid - readable writable attr _n_type: PType - readable writable attr _n_readable: PAble - readable writable attr _n_writable: PAble - readable writable attr _n_expr: PExpr + readable writable attr _n_kwredef: TKwredef = null + readable writable attr _n_visibility: PVisibility = null + readable writable attr _n_kwattr: TKwattr = null + readable writable attr _n_id: TAttrid = null + readable writable attr _n_type: PType = null + readable writable attr _n_readable: PAble = null + readable writable attr _n_writable: PAble = null + readable writable attr _n_expr: PExpr = null end class AMethPropdef special PPropdef - readable writable attr _n_kwredef: TKwredef - readable writable attr _n_visibility: PVisibility - readable writable attr _n_methid: PMethid - readable writable attr _n_signature: PSignature + readable writable attr _n_kwredef: TKwredef = null + readable writable attr _n_visibility: PVisibility = null + readable writable attr _n_methid: PMethid = null + readable writable attr _n_signature: PSignature = null end class ADeferredMethPropdef special AMethPropdef - readable writable attr _n_kwmeth: TKwmeth + readable writable attr _n_kwmeth: TKwmeth = null end class AInternMethPropdef special AMethPropdef - readable writable attr _n_kwmeth: TKwmeth + readable writable attr _n_kwmeth: TKwmeth = null end class AExternMethPropdef special AMethPropdef - readable writable attr _n_kwmeth: TKwmeth - readable writable attr _n_extern: TString + readable writable attr _n_kwmeth: TKwmeth = null + readable writable attr _n_extern: TString = null end class AConcreteMethPropdef special AMethPropdef - readable writable attr _n_kwmeth: TKwmeth - readable writable attr _n_block: PExpr + readable writable attr _n_kwmeth: TKwmeth = null + readable writable attr _n_block: PExpr = null end class AConcreteInitPropdef special AConcreteMethPropdef - readable writable attr _n_kwinit: TKwinit + readable writable attr _n_kwinit: TKwinit = null end class AMainMethPropdef special AConcreteMethPropdef end class ATypePropdef special PPropdef - readable writable attr _n_kwredef: TKwredef - readable writable attr _n_visibility: PVisibility - readable writable attr _n_kwtype: TKwtype - readable writable attr _n_id: TClassid - readable writable attr _n_type: PType + readable writable attr _n_kwredef: TKwredef = null + readable writable attr _n_visibility: PVisibility = null + readable writable attr _n_kwtype: TKwtype = null + readable writable attr _n_id: TClassid = null + readable writable attr _n_type: PType = null end class AReadAble special PAble - readable writable attr _n_kwreadable: TKwreadable + readable writable attr _n_kwreadable: TKwreadable = null end class AWriteAble special PAble - readable writable attr _n_kwwritable: TKwwritable + readable writable attr _n_kwwritable: TKwwritable = null end class AIdMethid special PMethid - readable writable attr _n_id: TId + readable writable attr _n_id: TId = null end class APlusMethid special PMethid - readable writable attr _n_plus: TPlus + readable writable attr _n_plus: TPlus = null end class AMinusMethid special PMethid - readable writable attr _n_minus: TMinus + readable writable attr _n_minus: TMinus = null end class AStarMethid special PMethid - readable writable attr _n_star: TStar + readable writable attr _n_star: TStar = null end class ASlashMethid special PMethid - readable writable attr _n_slash: TSlash + readable writable attr _n_slash: TSlash = null end class APercentMethid special PMethid - readable writable attr _n_percent: TPercent + readable writable attr _n_percent: TPercent = null end class AEqMethid special PMethid - readable writable attr _n_eq: TEq + readable writable attr _n_eq: TEq = null end class ANeMethid special PMethid - readable writable attr _n_ne: TNe + readable writable attr _n_ne: TNe = null end class ALeMethid special PMethid - readable writable attr _n_le: TLe + readable writable attr _n_le: TLe = null end class AGeMethid special PMethid - readable writable attr _n_ge: TGe + readable writable attr _n_ge: TGe = null end class ALtMethid special PMethid - readable writable attr _n_lt: TLt + readable writable attr _n_lt: TLt = null end class AGtMethid special PMethid - readable writable attr _n_gt: TGt + readable writable attr _n_gt: TGt = null end class ABraMethid special PMethid - readable writable attr _n_obra: TObra - readable writable attr _n_cbra: TCbra + readable writable attr _n_obra: TObra = null + readable writable attr _n_cbra: TCbra = null end class AStarshipMethid special PMethid - readable writable attr _n_starship: TStarship + readable writable attr _n_starship: TStarship = null end class AAssignMethid special PMethid - readable writable attr _n_id: TId - readable writable attr _n_assign: TAssign + readable writable attr _n_id: TId = null + readable writable attr _n_assign: TAssign = null end class ABraassignMethid special PMethid - readable writable attr _n_obra: TObra - readable writable attr _n_cbra: TCbra - readable writable attr _n_assign: TAssign + readable writable attr _n_obra: TObra = null + readable writable attr _n_cbra: TCbra = null + readable writable attr _n_assign: TAssign = null end class ASignature special PSignature - readable writable attr _n_params: List[PParam] - readable writable attr _n_type: PType + readable writable attr _n_params: List[PParam] = null + readable writable attr _n_type: PType = null end class AParam special PParam - readable writable attr _n_dotdotdot: TDotdotdot + readable writable attr _n_dotdotdot: TDotdotdot = null end class AType special PType - readable writable attr _n_id: TClassid - readable writable attr _n_types: List[PType] + readable writable attr _n_id: TClassid = null + readable writable attr _n_types: List[PType] = null end class ABlockExpr special PExpr - readable writable attr _n_expr: List[PExpr] + readable writable attr _n_expr: List[PExpr] = null end class AVardeclExpr special PExpr - readable writable attr _n_kwvar: TKwvar - readable writable attr _n_id: TId - readable writable attr _n_type: PType - readable writable attr _n_assign: TAssign - readable writable attr _n_expr: PExpr + readable writable attr _n_kwvar: TKwvar = null + readable writable attr _n_id: TId = null + readable writable attr _n_type: PType = null + readable writable attr _n_assign: TAssign = null + readable writable attr _n_expr: PExpr = null end class AReturnExpr special PExpr - readable writable attr _n_kwreturn: TKwreturn - readable writable attr _n_expr: PExpr + readable writable attr _n_kwreturn: TKwreturn = null + readable writable attr _n_expr: PExpr = null end class ABreakExpr special PExpr - readable writable attr _n_kwbreak: TKwbreak + readable writable attr _n_kwbreak: TKwbreak = null end class AAbortExpr special PExpr - readable writable attr _n_kwabort: TKwabort + readable writable attr _n_kwabort: TKwabort = null end class AContinueExpr special PExpr - readable writable attr _n_kwcontinue: TKwcontinue + readable writable attr _n_kwcontinue: TKwcontinue = null end class ADoExpr special PExpr - readable writable attr _n_kwdo: TKwdo - readable writable attr _n_block: PExpr + readable writable attr _n_kwdo: TKwdo = null + readable writable attr _n_block: PExpr = null end class AIfExpr special PExpr - readable writable attr _n_kwif: TKwif - readable writable attr _n_expr: PExpr - readable writable attr _n_then: PExpr - readable writable attr _n_else: PExpr + readable writable attr _n_kwif: TKwif = null + readable writable attr _n_expr: PExpr = null + readable writable attr _n_then: PExpr = null + readable writable attr _n_else: PExpr = null end class AIfexprExpr special PExpr - readable writable attr _n_kwif: TKwif - readable writable attr _n_expr: PExpr - readable writable attr _n_kwthen: TKwthen - readable writable attr _n_then: PExpr - readable writable attr _n_kwelse: TKwelse - readable writable attr _n_else: PExpr + readable writable attr _n_kwif: TKwif = null + readable writable attr _n_expr: PExpr = null + readable writable attr _n_kwthen: TKwthen = null + readable writable attr _n_then: PExpr = null + readable writable attr _n_kwelse: TKwelse = null + readable writable attr _n_else: PExpr = null end class AWhileExpr special PExpr - readable writable attr _n_kwwhile: TKwwhile - readable writable attr _n_expr: PExpr - readable writable attr _n_kwdo: TKwdo - readable writable attr _n_block: PExpr + readable writable attr _n_kwwhile: TKwwhile = null + readable writable attr _n_expr: PExpr = null + readable writable attr _n_kwdo: TKwdo = null + readable writable attr _n_block: PExpr = null end class AForExpr special PExpr - readable writable attr _n_vardecl: PExpr - readable writable attr _n_kwdo: TKwdo - readable writable attr _n_block: PExpr + readable writable attr _n_vardecl: PExpr = null + readable writable attr _n_kwdo: TKwdo = null + readable writable attr _n_block: PExpr = null end class AForVardeclExpr special PExpr - readable writable attr _n_kwfor: TKwfor - readable writable attr _n_id: TId - readable writable attr _n_expr: PExpr + readable writable attr _n_kwfor: TKwfor = null + readable writable attr _n_id: TId = null + readable writable attr _n_expr: PExpr = null end class AAssertExpr special PExpr - readable writable attr _n_kwassert: TKwassert - readable writable attr _n_id: TId - readable writable attr _n_expr: PExpr + readable writable attr _n_kwassert: TKwassert = null + readable writable attr _n_id: TId = null + readable writable attr _n_expr: PExpr = null end class AAssignFormExpr special PExpr - readable writable attr _n_assign: TAssign - readable writable attr _n_value: PExpr + readable writable attr _n_assign: TAssign = null + readable writable attr _n_value: PExpr = null end class AReassignFormExpr special PExpr - readable writable attr _n_assign_op: PAssignOp - readable writable attr _n_value: PExpr + readable writable attr _n_assign_op: PAssignOp = null + readable writable attr _n_value: PExpr = null end class AOnceExpr special AProxyExpr - readable writable attr _n_kwonce: TKwonce + readable writable attr _n_kwonce: TKwonce = null end class ASendExpr special PExpr - readable writable attr _n_expr: PExpr + readable writable attr _n_expr: PExpr = null end class ABinopExpr special ASendExpr - readable writable attr _n_expr2: PExpr + readable writable attr _n_expr2: PExpr = null end class ABoolExpr special PExpr end class AOrExpr special ABoolExpr - readable writable attr _n_expr: PExpr - readable writable attr _n_expr2: PExpr + readable writable attr _n_expr: PExpr = null + readable writable attr _n_expr2: PExpr = null end class AAndExpr special ABoolExpr - readable writable attr _n_expr: PExpr - readable writable attr _n_expr2: PExpr + readable writable attr _n_expr: PExpr = null + readable writable attr _n_expr2: PExpr = null end class ANotExpr special ABoolExpr - readable writable attr _n_kwnot: TKwnot - readable writable attr _n_expr: PExpr + readable writable attr _n_kwnot: TKwnot = null + readable writable attr _n_expr: PExpr = null end class AEqExpr special ABinopExpr end class AEeExpr special ABoolExpr - readable writable attr _n_expr: PExpr - readable writable attr _n_expr2: PExpr + readable writable attr _n_expr: PExpr = null + readable writable attr _n_expr2: PExpr = null end class ANeExpr special ABinopExpr @@ -667,8 +669,8 @@ special ABinopExpr end class AIsaExpr special ABoolExpr - readable writable attr _n_expr: PExpr - readable writable attr _n_type: PType + readable writable attr _n_expr: PExpr = null + readable writable attr _n_type: PType = null end class APlusExpr special ABinopExpr @@ -690,19 +692,19 @@ special ABinopExpr end class AUminusExpr special ASendExpr - readable writable attr _n_minus: TMinus + readable writable attr _n_minus: TMinus = null end class ANewExpr special PExpr - readable writable attr _n_kwnew: TKwnew - readable writable attr _n_type: PType - readable writable attr _n_id: TId - readable writable attr _n_args: List[PExpr] + readable writable attr _n_kwnew: TKwnew = null + readable writable attr _n_type: PType = null + readable writable attr _n_id: TId = null + readable writable attr _n_args: List[PExpr] = null end class AAttrFormExpr special PExpr - readable writable attr _n_expr: PExpr - readable writable attr _n_id: TAttrid + readable writable attr _n_expr: PExpr = null + readable writable attr _n_id: TAttrid = null end class AAttrExpr special AAttrFormExpr @@ -713,8 +715,8 @@ special AAssignFormExpr end class ACallFormExpr special ASendExpr - readable writable attr _n_id: TId - readable writable attr _n_args: List[PExpr] + readable writable attr _n_id: TId = null + readable writable attr _n_args: List[PExpr] = null end class AAttrReassignExpr special PExpr @@ -735,18 +737,18 @@ special AReassignFormExpr end class ASuperExpr special PExpr - readable writable attr _n_qualified: PQualified - readable writable attr _n_kwsuper: TKwsuper - readable writable attr _n_args: List[PExpr] + readable writable attr _n_qualified: PQualified = null + readable writable attr _n_kwsuper: TKwsuper = null + readable writable attr _n_args: List[PExpr] = null end class AInitExpr special ASendExpr - readable writable attr _n_kwinit: TKwinit - readable writable attr _n_args: List[PExpr] + readable writable attr _n_kwinit: TKwinit = null + readable writable attr _n_args: List[PExpr] = null end class ABraFormExpr special ASendExpr - readable writable attr _n_args: List[PExpr] + readable writable attr _n_args: List[PExpr] = null end class ABraExpr special ABraFormExpr @@ -757,7 +759,7 @@ special AAssignFormExpr end class AVarFormExpr special PExpr - readable writable attr _n_id: TId + readable writable attr _n_id: TId = null end class ABraReassignExpr special ABraFormExpr @@ -776,8 +778,8 @@ special AReassignFormExpr end class ARangeExpr special PExpr - readable writable attr _n_expr: PExpr - readable writable attr _n_expr2: PExpr + readable writable attr _n_expr: PExpr = null + readable writable attr _n_expr2: PExpr = null end class ACrangeExpr special ARangeExpr @@ -787,95 +789,95 @@ special ARangeExpr end class AArrayExpr special PExpr - readable writable attr _n_exprs: List[PExpr] + readable writable attr _n_exprs: List[PExpr] = null end class ASelfExpr special PExpr - readable writable attr _n_kwself: TKwself + readable writable attr _n_kwself: TKwself = null end class AImplicitSelfExpr special ASelfExpr end class ATrueExpr special ABoolExpr - readable writable attr _n_kwtrue: TKwtrue + readable writable attr _n_kwtrue: TKwtrue = null end class AFalseExpr special ABoolExpr - readable writable attr _n_kwfalse: TKwfalse + readable writable attr _n_kwfalse: TKwfalse = null end class ANullExpr special PExpr - readable writable attr _n_kwnull: TKwnull + readable writable attr _n_kwnull: TKwnull = null end class AIntExpr special PExpr - readable writable attr _n_number: TNumber + readable writable attr _n_number: TNumber = null end class AFloatExpr special PExpr - readable writable attr _n_float: TFloat + readable writable attr _n_float: TFloat = null end class ACharExpr special PExpr - readable writable attr _n_char: TChar + readable writable attr _n_char: TChar = null end class AStringFormExpr special PExpr end class AStringExpr special AStringFormExpr - readable writable attr _n_string: TString + readable writable attr _n_string: TString = null end class AStartStringExpr special AStringFormExpr - readable writable attr _n_string: TStartString + readable writable attr _n_string: TStartString = null end class AMidStringExpr special AStringFormExpr - readable writable attr _n_string: TMidString + readable writable attr _n_string: TMidString = null end class AEndStringExpr special AStringFormExpr - readable writable attr _n_string: TEndString + readable writable attr _n_string: TEndString = null end class ASuperstringExpr special PExpr - readable writable attr _n_exprs: List[PExpr] + readable writable attr _n_exprs: List[PExpr] = null end class AParExpr special AProxyExpr end class AProxyExpr special PExpr - readable writable attr _n_expr: PExpr + readable writable attr _n_expr: PExpr = null end class AAsCastExpr special PExpr - readable writable attr _n_expr: PExpr - readable writable attr _n_kwas: TKwas - readable writable attr _n_type: PType + readable writable attr _n_expr: PExpr = null + readable writable attr _n_kwas: TKwas = null + readable writable attr _n_type: PType = null end class APlusAssignOp special PAssignOp - readable writable attr _n_pluseq: TPluseq + readable writable attr _n_pluseq: TPluseq = null end class AMinusAssignOp special PAssignOp - readable writable attr _n_minuseq: TMinuseq + readable writable attr _n_minuseq: TMinuseq = null end class AQualified special PQualified - readable writable attr _n_id: List[TId] - readable writable attr _n_classid: TClassid + readable writable attr _n_id: List[TId] = null + readable writable attr _n_classid: TClassid = null end class ADoc special PDoc - readable writable attr _n_comment: List[TComment] + readable writable attr _n_comment: List[TComment] = null end class Start special Prod - readable writable attr _n_base: PModule - readable writable attr _n_eof: EOF + readable writable attr _n_base: PModule + readable writable attr _n_eof: EOF end diff --git a/src/parser/parser_prod.nit b/src/parser/parser_prod.nit index 5e312dc..895feaa 100644 --- a/src/parser/parser_prod.nit +++ b/src/parser/parser_prod.nit @@ -123,6 +123,7 @@ redef class AModule n_classdefs: Array[Object] # Should be Array[PClassdef] ) do + empty_init _n_packagedecl = n_packagedecl if n_packagedecl != null then n_packagedecl.parent = self @@ -245,6 +246,7 @@ redef class APackagedecl n_id: TId ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -351,6 +353,7 @@ redef class AImport n_id: TId ) do + empty_init _n_visibility = n_visibility if n_visibility != null then n_visibility.parent = self @@ -457,6 +460,7 @@ redef class ANoImport n_kwend: TKwend ) do + empty_init _n_visibility = n_visibility if n_visibility != null then n_visibility.parent = self @@ -538,6 +542,7 @@ redef class APublicVisibility init init_apublicvisibility do + empty_init end redef meth replace_child(old_child: PNode, new_child: PNode) @@ -568,6 +573,7 @@ redef class APrivateVisibility n_kwprivate: TKwprivate ) do + empty_init _n_kwprivate = n_kwprivate if n_kwprivate != null then n_kwprivate.parent = self @@ -618,6 +624,7 @@ redef class AProtectedVisibility n_kwprotected: TKwprotected ) do + empty_init _n_kwprotected = n_kwprotected if n_kwprotected != null then n_kwprotected.parent = self @@ -668,6 +675,7 @@ redef class AIntrudeVisibility n_kwintrude: TKwintrude ) do + empty_init _n_kwintrude = n_kwintrude if n_kwintrude != null then n_kwintrude.parent = self @@ -753,6 +761,7 @@ redef class AClassdef n_propdefs: Array[Object] # Should be Array[PPropdef] ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -960,6 +969,7 @@ redef class ATopClassdef n_propdefs: Array[Object] # Should be Array[PPropdef] ) do + empty_init _n_propdefs = new List[PPropdef] for n in n_propdefs do assert n isa PPropdef @@ -1011,6 +1021,7 @@ redef class AMainClassdef n_propdefs: Array[Object] # Should be Array[PPropdef] ) do + empty_init _n_propdefs = new List[PPropdef] for n in n_propdefs do assert n isa PPropdef @@ -1069,6 +1080,7 @@ redef class AConcreteClasskind n_kwclass: TKwclass ) do + empty_init _n_kwclass = n_kwclass if n_kwclass != null then n_kwclass.parent = self @@ -1127,6 +1139,7 @@ redef class AAbstractClasskind n_kwclass: TKwclass ) do + empty_init _n_kwabstract = n_kwabstract if n_kwabstract != null then n_kwabstract.parent = self @@ -1197,6 +1210,7 @@ redef class AInterfaceClasskind n_kwinterface: TKwinterface ) do + empty_init _n_kwinterface = n_kwinterface if n_kwinterface != null then n_kwinterface.parent = self @@ -1247,6 +1261,7 @@ redef class AUniversalClasskind n_kwuniversal: TKwuniversal ) do + empty_init _n_kwuniversal = n_kwuniversal if n_kwuniversal != null then n_kwuniversal.parent = self @@ -1305,6 +1320,7 @@ redef class AFormaldef n_type: PType ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -1383,6 +1399,7 @@ redef class ASuperclass n_type: PType ) do + empty_init _n_kwspecial = n_kwspecial if n_kwspecial != null then n_kwspecial.parent = self @@ -1517,6 +1534,7 @@ redef class AAttrPropdef n_expr: PExpr ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -1759,6 +1777,7 @@ redef class AMethPropdef n_signature: PSignature ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -1929,6 +1948,7 @@ redef class ADeferredMethPropdef n_signature: PSignature ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -2119,6 +2139,7 @@ redef class AInternMethPropdef n_signature: PSignature ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -2317,6 +2338,7 @@ redef class AExternMethPropdef n_extern: TString ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -2535,6 +2557,7 @@ redef class AConcreteMethPropdef n_block: PExpr ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -2753,6 +2776,7 @@ redef class AConcreteInitPropdef n_block: PExpr ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -2931,6 +2955,7 @@ redef class AMainMethPropdef n_block: PExpr ) do + empty_init _n_kwredef = n_kwredef if n_kwredef != null then n_kwredef.parent = self @@ -3041,6 +3066,7 @@ redef class ATypePropdef n_type: PType ) do + empty_init _n_doc = n_doc if n_doc != null then n_doc.parent = self @@ -3199,6 +3225,7 @@ redef class AReadAble n_kwreadable: TKwreadable ) do + empty_init _n_kwredef = n_kwredef if n_kwredef != null then n_kwredef.parent = self @@ -3277,6 +3304,7 @@ redef class AWriteAble n_kwwritable: TKwwritable ) do + empty_init _n_kwredef = n_kwredef if n_kwredef != null then n_kwredef.parent = self @@ -3347,6 +3375,7 @@ redef class AIdMethid n_id: TId ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -3397,6 +3426,7 @@ redef class APlusMethid n_plus: TPlus ) do + empty_init _n_plus = n_plus if n_plus != null then n_plus.parent = self @@ -3447,6 +3477,7 @@ redef class AMinusMethid n_minus: TMinus ) do + empty_init _n_minus = n_minus if n_minus != null then n_minus.parent = self @@ -3497,6 +3528,7 @@ redef class AStarMethid n_star: TStar ) do + empty_init _n_star = n_star if n_star != null then n_star.parent = self @@ -3547,6 +3579,7 @@ redef class ASlashMethid n_slash: TSlash ) do + empty_init _n_slash = n_slash if n_slash != null then n_slash.parent = self @@ -3597,6 +3630,7 @@ redef class APercentMethid n_percent: TPercent ) do + empty_init _n_percent = n_percent if n_percent != null then n_percent.parent = self @@ -3647,6 +3681,7 @@ redef class AEqMethid n_eq: TEq ) do + empty_init _n_eq = n_eq if n_eq != null then n_eq.parent = self @@ -3697,6 +3732,7 @@ redef class ANeMethid n_ne: TNe ) do + empty_init _n_ne = n_ne if n_ne != null then n_ne.parent = self @@ -3747,6 +3783,7 @@ redef class ALeMethid n_le: TLe ) do + empty_init _n_le = n_le if n_le != null then n_le.parent = self @@ -3797,6 +3834,7 @@ redef class AGeMethid n_ge: TGe ) do + empty_init _n_ge = n_ge if n_ge != null then n_ge.parent = self @@ -3847,6 +3885,7 @@ redef class ALtMethid n_lt: TLt ) do + empty_init _n_lt = n_lt if n_lt != null then n_lt.parent = self @@ -3897,6 +3936,7 @@ redef class AGtMethid n_gt: TGt ) do + empty_init _n_gt = n_gt if n_gt != null then n_gt.parent = self @@ -3955,6 +3995,7 @@ redef class ABraMethid n_cbra: TCbra ) do + empty_init _n_obra = n_obra if n_obra != null then n_obra.parent = self @@ -4025,6 +4066,7 @@ redef class AStarshipMethid n_starship: TStarship ) do + empty_init _n_starship = n_starship if n_starship != null then n_starship.parent = self @@ -4083,6 +4125,7 @@ redef class AAssignMethid n_assign: TAssign ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -4169,6 +4212,7 @@ redef class ABraassignMethid n_assign: TAssign ) do + empty_init _n_obra = n_obra if n_obra != null then n_obra.parent = self @@ -4260,6 +4304,7 @@ redef class ASignature n_type: PType ) do + empty_init _n_params = new List[PParam] for n in n_params do assert n isa PParam @@ -4354,6 +4399,7 @@ redef class AParam n_dotdotdot: TDotdotdot ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -4445,6 +4491,7 @@ redef class AType n_types: Array[Object] # Should be Array[PType] ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -4516,6 +4563,7 @@ redef class ABlockExpr n_expr: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_expr = new List[PExpr] for n in n_expr do assert n isa PExpr @@ -4606,6 +4654,7 @@ redef class AVardeclExpr n_expr: PExpr ) do + empty_init _n_kwvar = n_kwvar if n_kwvar != null then n_kwvar.parent = self @@ -4744,6 +4793,7 @@ redef class AReturnExpr n_expr: PExpr ) do + empty_init _n_kwreturn = n_kwreturn if n_kwreturn != null then n_kwreturn.parent = self @@ -4814,6 +4864,7 @@ redef class ABreakExpr n_kwbreak: TKwbreak ) do + empty_init _n_kwbreak = n_kwbreak if n_kwbreak != null then n_kwbreak.parent = self @@ -4864,6 +4915,7 @@ redef class AAbortExpr n_kwabort: TKwabort ) do + empty_init _n_kwabort = n_kwabort if n_kwabort != null then n_kwabort.parent = self @@ -4914,6 +4966,7 @@ redef class AContinueExpr n_kwcontinue: TKwcontinue ) do + empty_init _n_kwcontinue = n_kwcontinue if n_kwcontinue != null then n_kwcontinue.parent = self @@ -4972,6 +5025,7 @@ redef class ADoExpr n_block: PExpr ) do + empty_init _n_kwdo = n_kwdo if n_kwdo != null then n_kwdo.parent = self @@ -5066,6 +5120,7 @@ redef class AIfExpr n_else: PExpr ) do + empty_init _n_kwif = n_kwif if n_kwif != null then n_kwif.parent = self @@ -5216,6 +5271,7 @@ redef class AIfexprExpr n_else: PExpr ) do + empty_init _n_kwif = n_kwif if n_kwif != null then n_kwif.parent = self @@ -5390,6 +5446,7 @@ redef class AWhileExpr n_block: PExpr ) do + empty_init _n_kwwhile = n_kwwhile if n_kwwhile != null then n_kwwhile.parent = self @@ -5516,6 +5573,7 @@ redef class AForExpr n_block: PExpr ) do + empty_init _n_vardecl = n_vardecl if n_vardecl != null then n_vardecl.parent = self @@ -5622,6 +5680,7 @@ redef class AForVardeclExpr n_expr: PExpr ) do + empty_init _n_kwfor = n_kwfor if n_kwfor != null then n_kwfor.parent = self @@ -5728,6 +5787,7 @@ redef class AAssertExpr n_expr: PExpr ) do + empty_init _n_kwassert = n_kwassert if n_kwassert != null then n_kwassert.parent = self @@ -5826,6 +5886,7 @@ redef class AOnceExpr n_expr: PExpr ) do + empty_init _n_kwonce = n_kwonce if n_kwonce != null then n_kwonce.parent = self @@ -5896,6 +5957,7 @@ redef class ASendExpr n_expr: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -5954,6 +6016,7 @@ redef class ABinopExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6032,6 +6095,7 @@ redef class AOrExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6110,6 +6174,7 @@ redef class AAndExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6188,6 +6253,7 @@ redef class ANotExpr n_expr: PExpr ) do + empty_init _n_kwnot = n_kwnot if n_kwnot != null then n_kwnot.parent = self @@ -6266,6 +6332,7 @@ redef class AEqExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6344,6 +6411,7 @@ redef class AEeExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6422,6 +6490,7 @@ redef class ANeExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6500,6 +6569,7 @@ redef class ALtExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6578,6 +6648,7 @@ redef class ALeExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6656,6 +6727,7 @@ redef class AGtExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6734,6 +6806,7 @@ redef class AGeExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6812,6 +6885,7 @@ redef class AIsaExpr n_type: PType ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6890,6 +6964,7 @@ redef class APlusExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -6968,6 +7043,7 @@ redef class AMinusExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7046,6 +7122,7 @@ redef class AStarshipExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7124,6 +7201,7 @@ redef class AStarExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7202,6 +7280,7 @@ redef class ASlashExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7280,6 +7359,7 @@ redef class APercentExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7358,6 +7438,7 @@ redef class AUminusExpr n_expr: PExpr ) do + empty_init _n_minus = n_minus if n_minus != null then n_minus.parent = self @@ -7445,6 +7526,7 @@ redef class ANewExpr n_args: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_kwnew = n_kwnew if n_kwnew != null then n_kwnew.parent = self @@ -7571,6 +7653,7 @@ redef class AAttrExpr n_id: TAttrid ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7665,6 +7748,7 @@ redef class AAttrAssignExpr n_value: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7799,6 +7883,7 @@ redef class AAttrReassignExpr n_value: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -7918,6 +8003,7 @@ redef class ACallExpr n_args: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -8041,6 +8127,7 @@ redef class ACallAssignExpr n_value: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -8204,6 +8291,7 @@ redef class ACallReassignExpr n_value: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -8351,6 +8439,7 @@ redef class ASuperExpr n_args: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_qualified = n_qualified if n_qualified != null then n_qualified.parent = self @@ -8458,6 +8547,7 @@ redef class AInitExpr n_args: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -8557,6 +8647,7 @@ redef class ABraExpr n_args: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -8652,6 +8743,7 @@ redef class ABraAssignExpr n_value: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -8787,6 +8879,7 @@ redef class ABraReassignExpr n_value: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -8905,6 +8998,7 @@ redef class AVarExpr n_id: TId ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -8971,6 +9065,7 @@ redef class AVarAssignExpr n_value: PExpr ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -9077,6 +9172,7 @@ redef class AVarReassignExpr n_value: PExpr ) do + empty_init _n_id = n_id if n_id != null then n_id.parent = self @@ -9175,6 +9271,7 @@ redef class ARangeExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -9253,6 +9350,7 @@ redef class ACrangeExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -9331,6 +9429,7 @@ redef class AOrangeExpr n_expr2: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -9394,6 +9493,7 @@ redef class AArrayExpr n_exprs: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_exprs = new List[PExpr] for n in n_exprs do assert n isa PExpr @@ -9452,6 +9552,7 @@ redef class ASelfExpr n_kwself: TKwself ) do + empty_init _n_kwself = n_kwself if n_kwself != null then n_kwself.parent = self @@ -9493,6 +9594,7 @@ redef class AImplicitSelfExpr init init_aimplicitselfexpr do + empty_init end redef meth replace_child(old_child: PNode, new_child: PNode) @@ -9523,6 +9625,7 @@ redef class ATrueExpr n_kwtrue: TKwtrue ) do + empty_init _n_kwtrue = n_kwtrue if n_kwtrue != null then n_kwtrue.parent = self @@ -9573,6 +9676,7 @@ redef class AFalseExpr n_kwfalse: TKwfalse ) do + empty_init _n_kwfalse = n_kwfalse if n_kwfalse != null then n_kwfalse.parent = self @@ -9623,6 +9727,7 @@ redef class ANullExpr n_kwnull: TKwnull ) do + empty_init _n_kwnull = n_kwnull if n_kwnull != null then n_kwnull.parent = self @@ -9673,6 +9778,7 @@ redef class AIntExpr n_number: TNumber ) do + empty_init _n_number = n_number if n_number != null then n_number.parent = self @@ -9723,6 +9829,7 @@ redef class AFloatExpr n_float: TFloat ) do + empty_init _n_float = n_float if n_float != null then n_float.parent = self @@ -9773,6 +9880,7 @@ redef class ACharExpr n_char: TChar ) do + empty_init _n_char = n_char if n_char != null then n_char.parent = self @@ -9823,6 +9931,7 @@ redef class AStringExpr n_string: TString ) do + empty_init _n_string = n_string if n_string != null then n_string.parent = self @@ -9873,6 +9982,7 @@ redef class AStartStringExpr n_string: TStartString ) do + empty_init _n_string = n_string if n_string != null then n_string.parent = self @@ -9923,6 +10033,7 @@ redef class AMidStringExpr n_string: TMidString ) do + empty_init _n_string = n_string if n_string != null then n_string.parent = self @@ -9973,6 +10084,7 @@ redef class AEndStringExpr n_string: TEndString ) do + empty_init _n_string = n_string if n_string != null then n_string.parent = self @@ -10016,6 +10128,7 @@ redef class ASuperstringExpr n_exprs: Array[Object] # Should be Array[PExpr] ) do + empty_init _n_exprs = new List[PExpr] for n in n_exprs do assert n isa PExpr @@ -10074,6 +10187,7 @@ redef class AParExpr n_expr: PExpr ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -10140,6 +10254,7 @@ redef class AAsCastExpr n_type: PType ) do + empty_init _n_expr = n_expr if n_expr != null then n_expr.parent = self @@ -10230,6 +10345,7 @@ redef class APlusAssignOp n_pluseq: TPluseq ) do + empty_init _n_pluseq = n_pluseq if n_pluseq != null then n_pluseq.parent = self @@ -10280,6 +10396,7 @@ redef class AMinusAssignOp n_minuseq: TMinuseq ) do + empty_init _n_minuseq = n_minuseq if n_minuseq != null then n_minuseq.parent = self @@ -10331,6 +10448,7 @@ redef class AQualified n_classid: TClassid ) do + empty_init _n_id = new List[TId] for n in n_id do assert n isa TId @@ -10402,6 +10520,7 @@ redef class ADoc n_comment: Array[Object] # Should be Array[TComment] ) do + empty_init _n_comment = new List[TComment] for n in n_comment do assert n isa TComment diff --git a/src/parser/xss/lexer.xss b/src/parser/xss/lexer.xss index 843a52b..f940e60 100644 --- a/src/parser/xss/lexer.xss +++ b/src/parser/xss/lexer.xss @@ -178,10 +178,10 @@ $ foreach {//token} $ if {not(@text)} $ if {@parser_index} var token_text = _text.substring(0, accept_length) - var token = new @ename(token_text, _filename, start_line + 1, start_pos + 1) + var token = new @ename.init_tk(token_text, _filename, start_line + 1, start_pos + 1) $ end $ else - var token = new @ename(_filename, start_line + 1, start_pos + 1) + var token = new @ename.init_tk(_filename, start_line + 1, start_pos + 1) $ end push_back(accept_length) _pos = accept_pos diff --git a/src/parser/xss/prods.xss b/src/parser/xss/prods.xss index d00060b..5ed318a 100644 --- a/src/parser/xss/prods.xss +++ b/src/parser/xss/prods.xss @@ -76,6 +76,7 @@ $ else init init_${translate(@ename,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} $ end do + empty_init $ foreach {elem} $ if @is_list _n_@{name} = new List[@{etype}] diff --git a/src/parser/xss/tokens.xss b/src/parser/xss/tokens.xss index 9e9f808..2796cde 100644 --- a/src/parser/xss/tokens.xss +++ b/src/parser/xss/tokens.xss @@ -26,9 +26,11 @@ $ end $ end class EOF special Token +private init noinit do end end class PError special EOF +private init noinit do end end $ end template @@ -56,11 +58,11 @@ redef class @ename end $ if {not(@text)} - init(text: String, fname: String, line: Int, pos: Int) + init init_tk(text: String, fname: String, line: Int, pos: Int) do _text = text $ else - init(fname: String, line: Int, pos: Int) + init init_tk(fname: String, line: Int, pos: Int) do _text = once "${sablecc:string2escaped_unicode(@text)}" $ end diff --git a/tests/base_attr.nit b/tests/base_attr.nit index 736d7ff..21f52a6 100644 --- a/tests/base_attr.nit +++ b/tests/base_attr.nit @@ -49,7 +49,7 @@ special Foo _a3.output end - redef init + init do _a1 = 10 _a2 = 20 diff --git a/tests/base_attr_def.nit b/tests/base_attr_def.nit index 24e0037..c11247e 100644 --- a/tests/base_attr_def.nit +++ b/tests/base_attr_def.nit @@ -49,7 +49,7 @@ special Foo a3.output end - redef init + init do a1 = 10 a2 = 20 diff --git a/tests/base_classid.nit b/tests/base_classid.nit index ec1415b..30e14b3 100644 --- a/tests/base_classid.nit +++ b/tests/base_classid.nit @@ -28,12 +28,12 @@ special A a = new B (a isa C).output end - redef init do end + init do end end class C special A - redef init do end + init do end end var a: A diff --git a/tests/base_eq.nit b/tests/base_eq.nit index b2db161..20d0306 100644 --- a/tests/base_eq.nit +++ b/tests/base_eq.nit @@ -36,7 +36,7 @@ special A return a.a is _a end - redef init(b: Int) + init(b: Int) do _a = b end diff --git a/tests/base_gen.nit b/tests/base_gen.nit index 0df5b69..3980ad4 100644 --- a/tests/base_gen.nit +++ b/tests/base_gen.nit @@ -39,7 +39,7 @@ special A (i+1).output end - redef init do end + init do end end class G[E: Object] diff --git a/tests/base_init_linext2.nit b/tests/base_init_linext2.nit index 624aa6f..3eb7e62 100644 --- a/tests/base_init_linext2.nit +++ b/tests/base_init_linext2.nit @@ -48,11 +48,13 @@ special A ' '.output end init init_par do + inita 'B'.output '3'.output ' '.output end init init_par2(c: Char) do + inita 'B'.output '4'.output c.output @@ -62,7 +64,7 @@ end class C special A - init initc do + init do 'C'.output '1'.output ' '.output @@ -99,13 +101,13 @@ special C 'D'.output '1'.output ' '.output -#alt4# initc +#alt4# init initb #!alt2# 'D'.output '2'.output ' '.output #alt5# initb -#alt3# initc +#alt3# init 'D'.output '3'.output ' '.output @@ -117,6 +119,6 @@ end (new B.initb).work (new B.init_par).work (new B.init_par2('y')).work -(new C.initc).work +(new C).work (new C.init_par('z')).work (new D.initd).work diff --git a/tests/base_isa.nit b/tests/base_isa.nit index 0e41f32..32861e2 100644 --- a/tests/base_isa.nit +++ b/tests/base_isa.nit @@ -30,7 +30,7 @@ end class B special A special U - redef init do end + init do end end var a: Object = new A diff --git a/tests/base_primitive.nit b/tests/base_primitive.nit index 57ef32c..396f0d2 100644 --- a/tests/base_primitive.nit +++ b/tests/base_primitive.nit @@ -50,7 +50,7 @@ special A (i*100).output end - redef init do end + init do end end var a = new A diff --git a/tests/base_simple.nit b/tests/base_simple.nit index a9f1afd..885fd8a 100644 --- a/tests/base_simple.nit +++ b/tests/base_simple.nit @@ -52,7 +52,7 @@ special A 0.output end - redef init + init do 1.output end diff --git a/tests/base_simple2.nit b/tests/base_simple2.nit index 1d23616..5d2df41 100644 --- a/tests/base_simple2.nit +++ b/tests/base_simple2.nit @@ -62,7 +62,7 @@ special A 0.output end - redef init + init do 1.output end diff --git a/tests/base_virtual_type.nit b/tests/base_virtual_type.nit index 9f1023a..23a4b2b 100644 --- a/tests/base_virtual_type.nit +++ b/tests/base_virtual_type.nit @@ -19,7 +19,7 @@ import kernel class A type E: T - readable writable attr _e: E + readable writable attr _e: E = null end class B diff --git a/tests/base_virtual_type2.nit b/tests/base_virtual_type2.nit index 0d56676..e20f497 100644 --- a/tests/base_virtual_type2.nit +++ b/tests/base_virtual_type2.nit @@ -19,7 +19,7 @@ import kernel class A type E: T - readable writable attr _e: E + readable writable attr _e: E = null end class B diff --git a/tests/bench_complex_sort.nit b/tests/bench_complex_sort.nit index 9ee9dda..7ebe0f1 100644 --- a/tests/bench_complex_sort.nit +++ b/tests/bench_complex_sort.nit @@ -15,30 +15,30 @@ # limitations under the License. -class Elt +interface Elt meth val1: Int is abstract - meth val2: Int do return val1 end + meth val2: Int do return val1 end class A special Elt attr _a: Int - redef meth val1: Int do return _a end + redef meth val1: Int do return _a - init(i: Int) do _a = i end + init(i: Int) do _a = i end class Elt2 special Elt attr _b: Int - redef meth val1: Int do return _b/2 end - redef meth val2: Int do return _b end + redef meth val1: Int do return _b/2 + redef meth val2: Int do return _b + init initelt2(i: Int) do _b = i end class B special Elt2 - - init(i: Int) do _b = i end + init(i: Int) do initelt2(i) end class C @@ -62,7 +62,7 @@ special Elt2 init init2(i: Int, j: Int) do init(i) - _b = j + initelt2(j) end end @@ -70,7 +70,7 @@ class E special Elt2 redef meth val1: Int do return 5 end - init(i: Int) do _b = i end + init(i: Int) do initelt2(i) end class EltSorter diff --git a/tests/bench_netsim.nit b/tests/bench_netsim.nit index 74781ca..6379f74 100644 --- a/tests/bench_netsim.nit +++ b/tests/bench_netsim.nit @@ -19,7 +19,7 @@ class Node do return _name end - attr _name: String + attr _name: String = null end class WakeUpNode @@ -31,12 +31,12 @@ special Node do _scheduler.add_event(self, d) end - attr _scheduler: Scheduler + attr _scheduler: Scheduler = null end class NodeSource special Node - attr _nexts: ArraySet[NodeSink] + attr _nexts: ArraySet[NodeSink] = null meth attach(n: NodeSink) # Add the sink `n' the the connected nodes # Do nothing if `n' is already connected @@ -155,7 +155,7 @@ end class CountSink special NodeSink - readable attr _count: Int + readable attr _count: Int = 0 redef meth recieve(n: NodeSource) do _count = _count + 1 diff --git a/tests/bench_send.nit b/tests/bench_send.nit index 61c57fb..e3ee5ee 100644 --- a/tests/bench_send.nit +++ b/tests/bench_send.nit @@ -58,7 +58,7 @@ special A return 1 end - redef init + init do end end @@ -70,7 +70,7 @@ special A return 2 end - redef init + init do end end @@ -82,7 +82,7 @@ special A return 3 end - redef init + init do end end diff --git a/tests/bench_send2.nit b/tests/bench_send2.nit index 7bf907f..c1e29c6 100644 --- a/tests/bench_send2.nit +++ b/tests/bench_send2.nit @@ -24,32 +24,32 @@ end class B special A redef meth foo do end - redef init do end + init do end end class C special A - redef init do end + init do end end class D special B special C - redef init do end + init do end end class E special B special C redef meth foo do end - redef init do end + init do end end class F special D special E redef meth foo do end - redef init do end + init do end end diff --git a/tests/example_objet.nit b/tests/example_objet.nit index c4f4dd1..db8bc4f 100644 --- a/tests/example_objet.nit +++ b/tests/example_objet.nit @@ -208,8 +208,8 @@ end class Rayon private - attr _stock: Array[Produit] # Des produits en stock - attr _rubrique: String # La catégorie des produits stockés + attr _stock: Array[Produit] = null # Des produits en stock + attr _rubrique: String = null # La catégorie des produits stockés # Cette fonction est utilisé par to_s pour afficher un petit titre meth to_s_head: String diff --git a/tests/sav/base_init_linext2_alt1.sav b/tests/sav/base_init_linext2_alt1.sav index ba321e3..cdf7048 100644 --- a/tests/sav/base_init_linext2_alt1.sav +++ b/tests/sav/base_init_linext2_alt1.sav @@ -1 +1 @@ -alt/base_init_linext2_alt1.nit:98,3--7: Error: No contructor named initd in superclasses. +alt/base_init_linext2_alt1.nit:100,3--7: Error: No contructor named initd in superclasses. diff --git a/tests/sav/base_init_linext2_alt4.sav b/tests/sav/base_init_linext2_alt4.sav index 5de5823..74c35e0 100644 --- a/tests/sav/base_init_linext2_alt4.sav +++ b/tests/sav/base_init_linext2_alt4.sav @@ -1,2 +1,2 @@ -alt/base_init_linext2_alt4.nit:103,3--7: Error: Constructor of B must be invoked before constructor of C -alt/base_init_linext2_alt4.nit:97,2--111:12: Error: Conflicting default constructor to call for B: initb, init_par. +alt/base_init_linext2_alt4.nit:105,3--7: Error: Constructor of B must be invoked before constructor of C +alt/base_init_linext2_alt4.nit:99,2--113:12: Error: Conflicting default constructor to call for B: initb, init_par. diff --git a/tests/sav/base_init_linext2_alt5.sav b/tests/sav/base_init_linext2_alt5.sav index fe48c02..f40f3a8 100644 --- a/tests/sav/base_init_linext2_alt5.sav +++ b/tests/sav/base_init_linext2_alt5.sav @@ -1 +1 @@ -alt/base_init_linext2_alt5.nit:107,3--7: Error: Only one super constructor invocation of class B is allowed. +alt/base_init_linext2_alt5.nit:109,3--7: Error: Only one super constructor invocation of class B is allowed. -- 1.7.9.5