end
class Foo
- var a1: Int
- var a2: Int
+ var a1: Int is noinit
+ var a2: Int is noinit
fun run
do
_a1.output
class Bar
super Foo
- var a3: Int
+ var a3: Int is noinit
redef fun run
do
_a1.output
import kernel
class A[E]
- var e: E
- init do end
+ var e: E is noinit
end
+
var i = 1
var a = new A[nullable Int]#alt1#
#alt1#var a = new A[Int]
class Integer
var val: Int
- init(val: Int) do _val = val
+
fun output do _val.output
end
class Foo
- var a1: Integer
- var a2: Integer
+ var a1: Integer is noinit
+ var a2: Integer is noinit
fun run
do
_a1.output
class Bar
super Foo
- var a3: Integer#alt1# #alt2#
+ var a3: Integer is noinit#alt1# #alt2#
#alt1#var a3: Integer = new Integer(9000)
- #alt2#var a3: nullable Integer
+ #alt2#var a3: nullable Integer is noinit
redef fun run
do
_a1.output
init
do
- nop
+ if false then super # no auto super init call
show(4)
_a1 = new Integer(10)
show(5)
interface Object
end
-
+enum Bool end
enum Int
fun output is intern
fun +(o: Int): Int is intern
end
class Foo
- var a1: Integer
- var a2: Integer
+ var a1: Integer is noinit
+ var a2: Integer is noinit
fun run
do
_a1.output
class Bar
super Foo
- var a3: Integer
+ var a3: Integer is noinit
redef fun run
do
_a1.output
init
do
- nop
+ if false then super # no auto super init call
#alt3#run
_a1 = new Integer(10)
#alt4#run_other(self)
interface Object
end
-
+enum Bool end
enum Int
fun output is intern
fun +(o: Int): Int is intern
end
class Foo
- var a1: Int
- var a2: Int
+ var a1: Int is noinit
+ var a2: Int is noinit
fun run
do
_a1.output
class Bar
super Foo
- var a3: Int
+ var a3: Int is noinit
redef fun run
do
_a1.output
init
do
- nop
+ if false then super # no auto super init call
#alt3#run
_a1 = 10
#alt4#run_other(self)
protected fun proA(a: A) do end
private fun priA(a: A) do end
- var vpubA: nullable A is writable
- protected var vproA: nullable A is protected writable
- private var vpriA: nullable A
+ var vpubA: nullable A is writable, noinit
+ protected var vproA: nullable A is protected writable, noinit
+ private var vpriA: nullable A is noinit
var vpubA2 = new A is writable
protected var vproA2 = new A is protected writable
#alt2#protected fun proB(a: B) do end
private fun priB(a: B) do end
- #alt3#var vpubB: nullable B is writable
- #alt4#protected var vproB: nullable B is protected writable
- private var vpriB: nullable B
+ #alt3#var vpubB: nullable B is writable, noinit
+ #alt4#protected var vproB: nullable B is protected writable, noinit
+ private var vpriB: nullable B is noinit
#alt5#var vpubB2 = new B is writable
#alt6#protected var vproB2 = new B is protected writable
private var vpriB2 = new B
- init do end
+
end
private class B
#alt7#protected fun proA(a: A) do end
private fun priA(a: A) do end
- var vpubA: nullable A is writable
- #alt7#protected var vproA: nullable A is protected writable
- private var vpriA: nullable A
+ var vpubA: nullable A is writable, noinit
+ #alt7#protected var vproA: nullable A is protected writable, noinit
+ private var vpriA: nullable A is noinit
var vpubA2 = new A is writable
#alt7#protected var vproA2 = new A is protected writable
#alt7#protected fun proB(a: B) do end
private fun priB(a: B) do end
- var vpubB: nullable B is writable
- #alt7#protected var vproB: nullable B is protected writable
- private var vpriB: nullable B
+ var vpubB: nullable B is writable, noinit
+ #alt7#protected var vproB: nullable B is protected writable, noinit
+ private var vpriB: nullable B is noinit
var vpubB2 = new B is writable
#alt7#protected var vproB2 = new B is protected writable
private var vpriB2 = new B
- init do end
+
end
#alt2#protected fun proA(a: A) do end
private fun priA(a: A) do end
- #alt3#var vpubA: nullable A is writable
- #alt4#protected var vproA: nullable A is protected writable
- private var vpriA: nullable A
+ #alt3#var vpubA: nullable A is writable, noinit
+ #alt4#protected var vproA: nullable A is protected writable, noinit
+ private var vpriA: nullable A is noinit
#alt5#var vpubA2 = new A is writable
#alt6#protected var vproA2 = new A is protected writable
fun pubA(a: A) do end
private fun priA(a: A) do end
- var vpubA: nullable A is writable
- private var vpriA: nullable A
+ var vpubA: nullable A is writable, noinit
+ private var vpriA: nullable A is noinit
var vpubA2 = new A is writable
private var vpriA2 = new A
do
0.output
end
-
- init
- do
- end
end
class B
class C
super A
- var tab: nullable Array[E] is writable
- init do end
+ var tab: nullable Array[E] = null is writable
end
+
var c = new C
c.tab = new Array[T]
c.tab.add(new U)
class A[E]
type T: E
- var t: T
+ var t: T is noinit
fun foo(t: T) do end
fun foo2: T do return _t
fun bar(t: A[T]) do end
fun bar2: A[T] do return self
- init do end
+
end
class B
do
_scheduler.add_event(self, d)
end
- var scheduler: Scheduler
- init do end
+ var scheduler: Scheduler is noinit
end
class NodeSource
end
class Integer
- var value: Int
-
- init
- do
- value = 42
- end
+ var value: Int = 42
end
var n = 100
class Rayon
private
- var stock: Array[Produit] # Des produits en stock
- var rubrique: String # La catégorie des produits stockés
+ var stock: Array[Produit] is noinit # Des produits en stock
+ var rubrique: String is noinit # La catégorie des produits stockés
# Cette fonction est utilisé par to_s pour afficher un petit titre
fun to_s_head: String
# pour obtenir la quantité de clous dans le rayon, et :
# r.quantite("clous") = 15
# pour mettre le nombre de clous à 15
-
- init do end
end
class RayonNormal
class A
var o: Object = 'c'
- var a: I
+ var a: I is noinit
var b: nullable I = null
#alt2#var c: I = self.a
#alt3#var d: I = self.b.as(not null)
class StringTest
- var copied_str: nullable String
+ var copied_str: nullable String = null
- var referenced_str: nullable String
-
- init
- do
- copied_str = null
- referenced_str = null
- end
+ var referenced_str: nullable String = null
fun get_c_string import FlatString.items, NativeString.to_s, NativeString.to_s_with_copy, StringTest.ref_test, StringTest.copy_test `{
char* string = "This is a test string";
end
class Test
- var t: Toto
+ var t: Toto is noinit
init
do
class MyApp
super GtkCallable
- var win : GtkWindow
+ var win : GtkWindow is noinit
- var container : GtkContainer
+ var container : GtkContainer is noinit
- var lbl : GtkLabel
- var but_ok : GtkButton
- var but_cancel : GtkButton
+ var lbl : GtkLabel is noinit
+ var but_ok : GtkButton is noinit
+ var but_cancel : GtkButton is noinit
redef fun signal( sender, user_data )
do
row[y] = v
end
-private
- var tab: Array[Array[Int]] # An array of array to store items
-
-
- init
- # Build an empty matrice
- do
- _tab = new Array[Array[Int]]
- end
+ private var tab = new Array[Array[Int]] # An array of array to store items
end