end
class Foo
- readable writable var _a1: Int
- readable writable var _a2: Int
+ var a1: Int
+ var a2: Int
fun run
do
a1.output
class Bar
super Foo
- readable writable var _a3: Int
+ var a3: Int
redef fun run
do
a1.output
import kernel
class A
- readable var _i: Int = 1
+ var i: Int = 1
init do end
end
class B
- readable var _a: A = new A
+ var a: A = new A
init do end
end
import kernel
class A
- readable var _i: Int = foo
+ var i: Int = foo
fun foo: Int do return 1
init do end
end
class B
- readable var _a: A = bar
+ var a: A = bar
fun bar: A do return new A
init do end
end
import kernel
class A
- readable var _a: Int
-
+ var a: Int
+
init(a: Int)
do
- _a = a
+ a = a
end
end
class B
super A
- redef fun ==(a: nullable Object): Bool
+ redef fun ==(o: nullable Object): Bool
do
- if not a isa B then
+ if not o isa B then
return false
end
- return a.a.is_same_instance(_a)
+ return o.a.is_same_instance(a)
end
init(b: Int)
do
- _a = b
+ a = b
end
end
import kernel
class A
- readable var _x: Int #alt1#
- #alt1#readable var _x: Int = 2
- readable var _y: Int = -2 #alt2#
- #alt2#readable var _y: Int
- #alt3#init (xx: Int) do _x = xx
- #alt4#init foo(xx: Int) do _x = xx
+ var x: Int #alt1#
+ #alt1#var x: Int = 2
+ var y: Int = -2 #alt2#
+ #alt2#var y: Int
+ #alt3#init (xx: Int) do x = xx
+ #alt4#init foo(xx: Int) do x = xx
fun work
do
- _x.output
- _y.output
+ x.output
+ y.output
end
end
import kernel
class A
- readable writable var _i: Int
+ var i: Int
end
var a: nullable A = new A(1)
class A
type E: T
-
- readable writable var _e: nullable E = null
+
+ var e: nullable E writable = null
end
class B
class A
type E: T
- readable writable var _e: nullable E = null
+ var e: nullable E writable = null
end
class B
class C
super A
- readable writable var _tab: nullable Array[E]
+ var tab: nullable Array[E] writable
init do end
end
type F: E
type F2: F
- readable writable var _e: E
- readable writable var _f: F
- readable writable var _f2: F2
+ var e: E writable
+ var f: F writable
+ var f2: F2 writable
init(e: E, f: F, f2: F2)
do
- _e = e
- _f = f
- _f2 = f2
+ self.e = e
+ self.f = f
+ self.f2 = f2
end
end
class A
type E: F
type F: E
- readable writable var _e: nullable E = null
+ var e: nullable E writable = null
init do end
end
class CountSink
super NodeSink
- readable var _count: Int = 0
+ var count: Int = 0
redef fun recieve(n: NodeSource)
do
- _count = _count + 1
+ count = count + 1
end
end
var _limit: Int
redef fun recieve(n: NodeSource)
do
- var c = _count + 1
+ var c = count + 1
if c >= _limit then
- _count = 0
+ count = 0
send
else
- _count = c
+ count = c
end
end
end
class Integer
- readable writable var _value: Int
+ var value: Int
init
do
- _value = 42
+ value = 42
end
end
class A
- readable writable var _val: Int = 0
+ var val: Int = 0
fun hop(a: A, b: A, c: A)
do
if a.val > val then
import kernel
class A
- readable var _x: Int #alt1#
- #alt1#readable var _x: Int = 2
- readable var _y: Int = -2 #alt2#
- #alt2#readable var _y: Int
- #alt3#init (xx: Int) do _x = xx
- #alt4#init foo(xx: Int) do _x = xx
+ var x: Int #alt1#
+ #alt1#var x: Int = 2
+ var y: Int = -2 #alt2#
+ #alt2#var y: Int
+ #alt3#init (xx: Int) do x = xx
+ #alt4#init foo(xx: Int) do x = xx
fun work
do
- _x.output
- _y.output
+ x.output
+ y.output
end
end
end
class G
- readable writable var _a: Fail
+ var a: Fail
fun ma(a: Fail) do return
fun mb(a: Array[Fail]) do return
fun mc: Fail do return 0
# The Time class represents a quantity of time
class Time
# Internally, the quantity of time is stored in minutes
- readable writable var _min: Int = 0
+ var min: Int = 0
# The quantity ot time (in hours)
fun hour: Int
do
# Need to transform minutes in hours
- return _min / 60
+ return min / 60
end
# Set the quantity of time (in hour)
fun hour=(i: Int)
do
# Need to transform hours in minutes
- _min = i * 60
+ min = i * 60
end
# The quantity of tyme in human readable form (h:m)
# limitations under the License.
import kernel
-
class A
- readable writable var _foo: Int = 1
+ var foo: Int = 1
+ var _foo: Int = 2
end
var a: nullable A = null
error_type_not_ok4.nit:21,10--13: Type error: class Fail not found in module error_type_not_ok4.
error_type_not_ok4.nit:25,16--19: Type error: class Fail not found in module error_type_not_ok4.
-error_type_not_ok4.nit:29,28--31: Type error: class Fail not found in module error_type_not_ok4.
+error_type_not_ok4.nit:29,9--12: Type error: class Fail not found in module error_type_not_ok4.
error_type_not_ok4.nit:30,12--15: Type error: class Fail not found in module error_type_not_ok4.
error_type_not_ok4.nit:31,18--21: Type error: class Fail not found in module error_type_not_ok4.
error_type_not_ok4.nit:32,10--13: Type error: class Fail not found in module error_type_not_ok4.
alt/error_type_not_ok4_alt1.nit:21,10--13: Type error: 'Fail' is a generic class.
alt/error_type_not_ok4_alt1.nit:25,16--19: Type error: 'Fail' is a generic class.
-alt/error_type_not_ok4_alt1.nit:29,28--31: Type error: 'Fail' is a generic class.
+alt/error_type_not_ok4_alt1.nit:29,9--12: Type error: 'Fail' is a generic class.
alt/error_type_not_ok4_alt1.nit:30,12--15: Type error: 'Fail' is a generic class.
alt/error_type_not_ok4_alt1.nit:31,18--21: Type error: 'Fail' is a generic class.
alt/error_type_not_ok4_alt1.nit:32,10--13: Type error: 'Fail' is a generic class.
+++ /dev/null
-test_gen_inh.nit:36,48: Redef Error: Wrong static type. found Gen3#0, expected Gen1#0.
-test_gen_inh.nit:37,19--22: Redef Error: Wrong static type. found Char, expected Gen1#1.
min: base_simple3 (7)
std: 0.0
mnbr: number of refinement in module
- avg: 1.0
- max: base_simple3 (1)
- min: base_simple3 (1)
+ avg: 3.0
+ max: base_simple3 (3)
+ min: base_simple3 (3)
std: 0.0
mnbcc: number of concrete class in module (intro + redef)
avg: 4.0
min: base_simple3 (0)
std: 0.0
mnbic: number of interface in module (intro + redef)
- avg: 2.0
- max: base_simple3 (2)
- min: base_simple3 (2)
+ avg: 4.0
+ max: base_simple3 (4)
+ min: base_simple3 (4)
std: 0.0
## project base_empty_module
min: base_empty_module (1)
std: 3.0
mnbr: number of refinement in module
- avg: 0.0
- max: base_simple3 (1)
+ avg: 1.0
+ max: base_simple3 (3)
min: base_empty_module (0)
- std: 0.707
+ std: 1.581
mnbcc: number of concrete class in module (intro + redef)
avg: 2.0
max: base_simple3 (4)
min: base_simple3 (0)
std: 0.0
mnbic: number of interface in module (intro + redef)
- avg: 1.0
- max: base_simple3 (2)
+ avg: 2.0
+ max: base_simple3 (4)
min: base_empty_module (0)
- std: 1.0
+ std: 2.0
## global metrics
mnoa: number of ancestor modules
min: base_empty_module (1)
std: 5.0
mnbr: number of refinement in module
- avg: 1.0
- max: base_simple3 (1)
+ avg: 3.0
+ max: base_simple3 (3)
min: base_empty_module (0)
- std: 0.707
+ std: 2.121
mnbcc: number of concrete class in module (intro + redef)
avg: 5.0
max: base_simple3 (4)
min: base_simple3 (0)
std: 0.0
mnbic: number of interface in module (intro + redef)
- avg: 2.0
- max: base_simple3 (2)
+ avg: 4.0
+ max: base_simple3 (4)
min: base_empty_module (0)
- std: 1.414
+ std: 2.828
# MClasses metrics
<=0: sub-population=1 (33.33%); cumulated value=0 (0.0%)
<=1: sub-population=2 (66.66%); cumulated value=2 (100.00%)
## Classdef hierarchy
-Number of nodes: 9
-Number of edges: 23 (2.55 per node)
-Number of direct edges: 7 (0.77 per node)
+Number of nodes: 11
+Number of edges: 47 (4.27 per node)
+Number of direct edges: 9 (0.81 per node)
Distribution of greaters
- population: 9
+ population: 11
minimum value: 1
- maximum value: 3
- total value: 23
- average value: 2.55
+ maximum value: 5
+ total value: 47
+ average value: 4.27
distribution:
- <=1: sub-population=1 (11.11%); cumulated value=1 (4.34%)
- <=2: sub-population=2 (22.22%); cumulated value=4 (17.39%)
- <=4: sub-population=6 (66.66%); cumulated value=18 (78.26%)
+ <=1: sub-population=1 (9.09%); cumulated value=1 (2.12%)
+ <=4: sub-population=4 (36.36%); cumulated value=16 (34.04%)
+ <=8: sub-population=6 (54.54%); cumulated value=30 (63.82%)
Distribution of direct greaters
- population: 9
+ population: 11
minimum value: 0
- maximum value: 1
- total value: 7
- average value: 0.77
+ maximum value: 3
+ total value: 9
+ average value: 0.81
distribution:
- <=0: sub-population=2 (22.22%); cumulated value=0 (0.0%)
- <=1: sub-population=7 (77.77%); cumulated value=7 (100.00%)
+ <=0: sub-population=4 (36.36%); cumulated value=0 (0.0%)
+ <=1: sub-population=6 (54.54%); cumulated value=6 (66.66%)
+ <=4: sub-population=1 (9.09%); cumulated value=3 (33.33%)
Distribution of smallers
- population: 9
+ population: 11
minimum value: 1
- maximum value: 8
- total value: 23
- average value: 2.55
+ maximum value: 10
+ total value: 47
+ average value: 4.27
distribution:
- <=1: sub-population=7 (77.77%); cumulated value=7 (30.43%)
- <=8: sub-population=2 (22.22%); cumulated value=16 (69.56%)
+ <=1: sub-population=7 (63.63%); cumulated value=7 (14.89%)
+ <=16: sub-population=4 (36.36%); cumulated value=40 (85.10%)
Distribution of direct smallers
- population: 9
+ population: 11
minimum value: 0
maximum value: 6
- total value: 7
- average value: 0.77
+ total value: 9
+ average value: 0.81
distribution:
- <=0: sub-population=7 (77.77%); cumulated value=0 (0.0%)
- <=1: sub-population=1 (11.11%); cumulated value=1 (14.28%)
- <=8: sub-population=1 (11.11%); cumulated value=6 (85.71%)
+ <=0: sub-population=7 (63.63%); cumulated value=0 (0.0%)
+ <=1: sub-population=3 (27.27%); cumulated value=3 (33.33%)
+ <=8: sub-population=1 (9.09%); cumulated value=6 (66.66%)
## Class hierarchy
Number of nodes: 8
Number of edges: 14 (1.75 per node)
population: 47
minimum value: 1
maximum value: 39
- total value: 265
- average value: 5.63
+ total value: 267
+ average value: 5.68
distribution:
- <=1: sub-population=11 (23.40%); cumulated value=11 (4.15%)
- <=2: sub-population=9 (19.14%); cumulated value=18 (6.79%)
- <=4: sub-population=9 (19.14%); cumulated value=31 (11.69%)
- <=8: sub-population=9 (19.14%); cumulated value=54 (20.37%)
- <=16: sub-population=5 (10.63%); cumulated value=55 (20.75%)
- <=32: sub-population=3 (6.38%); cumulated value=57 (21.50%)
- <=64: sub-population=1 (2.12%); cumulated value=39 (14.71%)
+ <=1: sub-population=10 (21.27%); cumulated value=10 (3.74%)
+ <=2: sub-population=9 (19.14%); cumulated value=18 (6.74%)
+ <=4: sub-population=10 (21.27%); cumulated value=34 (12.73%)
+ <=8: sub-population=9 (19.14%); cumulated value=54 (20.22%)
+ <=16: sub-population=5 (10.63%); cumulated value=55 (20.59%)
+ <=32: sub-population=3 (6.38%); cumulated value=57 (21.34%)
+ <=64: sub-population=1 (2.12%); cumulated value=39 (14.60%)
list:
- TId: 39 (14.71%)
- APublicVisibility: 20 (7.54%)
- AListExprs: 19 (7.16%)
- ACallExpr: 18 (6.79%)
- TClassid: 16 (6.03%)
- TKwend: 10 (3.77%)
- TNumber: 10 (3.77%)
- AIntExpr: 10 (3.77%)
- AType: 9 (3.39%)
- ASignature: 8 (3.01%)
+ TId: 39 (14.60%)
+ APublicVisibility: 20 (7.49%)
+ AListExprs: 19 (7.11%)
+ ACallExpr: 18 (6.74%)
+ TClassid: 16 (5.99%)
+ TKwend: 10 (3.74%)
+ TNumber: 10 (3.74%)
+ ADecIntExpr: 10 (3.74%)
+ AType: 9 (3.37%)
+ ASignature: 8 (2.99%)
...
+ ASelfExpr: 1 (0.37%)
ACallAssignExpr: 1 (0.37%)
- TKwreturn: 1 (0.37%)
- AInternMethPropdef: 1 (0.37%)
- ATopClassdef: 1 (0.37%)
+ TKwself: 1 (0.37%)
+ AReturnExpr: 1 (0.37%)
AInterfaceClasskind: 1 (0.37%)
TKwinterface: 1 (0.37%)
- AReturnExpr: 1 (0.37%)
- TKwself: 1 (0.37%)
+ TKwreturn: 1 (0.37%)
+ AInternMethPropdef: 1 (0.37%)
AMainMethPropdef: 1 (0.37%)
AMainClassdef: 1 (0.37%)
## All identifiers of the AST
Number of enum kind: 2 (25.00%)
Number of class kind: 5 (62.50%)
-Number of class definitions: 9
+Number of class definitions: 11
Number of refined classes: 1 (12.50%)
-Average number of class refinments by classes: 0.12
-Average number of class refinments by refined classes: 1.00
+Average number of class refinments by classes: 0.37
+Average number of class refinments by refined classes: 3.00
Number of properties: 20
Number of MAttribute: 3 (15.00%)
Total number of implicit self: 4 (80.00%)
--- Construction of tables ---
Number of runtime classes: 7 (excluding interfaces and abstract classes)
-Average number of composing class definition by runtime class: 2.71
+Average number of composing class definition by runtime class: 4.42
Total size of tables (classes and instances): 35 (not including stuff like info for subtyping or call-next-method)
Average size of table by runtime class: 5.00
Values never redefined: 35 (100.00%)
blooming mclasses (threshold: 2.388)
B: 3.0
C: 3.0
-generating out/nitmetrics_args1.write/project_hierarchy.dot
-generating out/nitmetrics_args1.write/module_hierarchy.dot
# Inheritance metrics
base_simple3#Object#bar: 1 (4.54%)
base_simple3#Object#foo: 1 (4.54%)
base_simple3#C#init: 1 (4.54%)
+generating out/nitmetrics_args1.write/project_hierarchy.dot
+generating out/nitmetrics_args1.write/module_hierarchy.dot
class_hierarchy.dot
classdef_hierarchy.dot
inheritance/
\e[1m== refined classes\e[0m
redef interface \e[32m\e[1mObject\e[0m\e[0m
- \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 49-51)\e[0m
+ \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 49-49)\e[0m
+
+ redef interface \e[32m\e[1mObject\e[0m\e[0m
+ \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 50-50)\e[0m
+
+ redef interface \e[32m\e[1mObject\e[0m\e[0m
+ \e[30m\e[1mbase_simple3::Object\e[0m\e[0m\e[30m (lines 51-51)\e[0m
-alt/test_combined_assignment_alt1.nit:23,3--9: Error: Method '+' doesn't exists in Object.
-alt/test_combined_assignment_alt1.nit:28,3--9: Error: Method '+' doesn't exists in Object.
+alt/test_combined_assignment_alt1.nit:23,3--8: Error: Method '+' doesn't exists in Object.
+alt/test_combined_assignment_alt1.nit:28,3--8: Error: Method '+' doesn't exists in Object.
alt/test_combined_assignment_alt1.nit:29,10: Type error: expected Int, got Object
alt/test_combined_assignment_alt1.nit:49,1--8: Error: Method '+' doesn't exists in Object.
# By Flop
class Gene[T]
- readable var _a_ : T
+ var a_ : T
fun a: T
do
- return _a_
+ return a_
end
- init(a:T) do _a_ = a
+ init(a:T) do a_ = a
end
class GeneBool
super Gene[Bool]
fun a=(b: Bool)
do
- _a_ = b
+ a_ = b
end
init(a) do super(a)
# limitations under the License.
class A
- readable writable var _a: Int = 0#alt1#
- #alt1#readable writable var _a: Object = 0
+ var a: Int = 0#alt1#
+ #alt1#var a: Object = 0
init do end
fun foo
do
- _a += 2
+ a += 2
end
fun next: Int
do
- _a += 1
+ a += 1
return a
end
class Gen1[E, F]
- readable writable var _e: E
- var _f_: F
- fun f: F do return _f_ end
- fun f=(x: F) do _f_ = x end
+ var e: E
+ var f_: F
+ fun f: F do return f_ end
+ fun f=(x: F) do f_ = x end
- init(e:E) do _e = e
+ init(e:E) do self.e = e
end
class Gen2[G: Int]
class Gen3[H: Int]
super Gen1[H, Char]
- redef readable redef writable redef var _e: H
- redef var _f_: Char = 'N'
- redef fun f: Char do return _f_ end
- redef fun f=(x: Char) do _f_ = x end
+ redef var e: H redef writable
+ redef var f_: Char redef writable = 'N'
+ redef fun f: Char do return f_ end
+ redef fun f=(x: Char) do f_ = x end
init(e:H) do super(e)
end