fancy 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/README.md +38 -86
  2. data/bin/fdoc +2 -22
  3. data/bin/fspec +8 -3
  4. data/bin/ifancy +1 -1
  5. data/boot/fancy_ext.rb +1 -0
  6. data/boot/fancy_ext/array.rb +19 -0
  7. data/boot/fancy_ext/class.rb +2 -4
  8. data/boot/fancy_ext/module.rb +2 -0
  9. data/boot/fancy_ext/object.rb +0 -17
  10. data/boot/rbx-compiler/compiler/ast/method_def.rb +0 -4
  11. data/boot/rbx-compiler/compiler/ast/singleton_method_def.rb +0 -7
  12. data/boot/rbx-compiler/parser/fancy_parser.bundle +0 -0
  13. data/boot/rbx-compiler/parser/fancy_parser.c +1 -0
  14. data/doc/api/fancy.css +10 -1
  15. data/doc/api/fancy.jsonp +1 -1
  16. data/doc/api/fdoc.js +22 -9
  17. data/doc/api/octocat.png +0 -0
  18. data/doc/features.md +1 -2
  19. data/examples/actors.fy +1 -2
  20. data/examples/armstrong_numbers.fy +7 -3
  21. data/examples/blocks.fy +3 -3
  22. data/examples/distributing_proxy.fy +31 -0
  23. data/examples/future_sends.fy +15 -0
  24. data/examples/person.fy +1 -2
  25. data/lib/argv.fy +1 -7
  26. data/lib/array.fy +7 -11
  27. data/lib/block.fy +15 -0
  28. data/lib/boot.fy +4 -3
  29. data/lib/class.fy +354 -10
  30. data/lib/compiler.fy +1 -1
  31. data/lib/compiler/ast/assign.fy +4 -8
  32. data/lib/compiler/ast/async_send.fy +1 -2
  33. data/lib/compiler/ast/block.fy +5 -0
  34. data/lib/compiler/ast/class_def.fy +2 -1
  35. data/lib/compiler/ast/expression_list.fy +1 -2
  36. data/lib/compiler/ast/future_send.fy +1 -2
  37. data/lib/compiler/ast/identifier.fy +34 -17
  38. data/lib/compiler/ast/literals.fy +31 -19
  39. data/lib/compiler/ast/match.fy +5 -4
  40. data/lib/compiler/ast/message_send.fy +3 -5
  41. data/lib/compiler/ast/method_def.fy +0 -3
  42. data/lib/compiler/ast/range.fy +2 -4
  43. data/lib/compiler/ast/return.fy +2 -4
  44. data/lib/compiler/ast/script.fy +2 -4
  45. data/lib/compiler/ast/singleton_method_def.fy +0 -3
  46. data/lib/compiler/ast/string_interpolation.fy +2 -2
  47. data/lib/compiler/ast/super.fy +2 -4
  48. data/lib/compiler/ast/try_catch.fy +13 -9
  49. data/lib/compiler/ast/tuple_literal.fy +1 -2
  50. data/lib/compiler/compiler.fy +2 -2
  51. data/lib/compiler/stages.fy +3 -6
  52. data/lib/contracts.fy +89 -57
  53. data/lib/dynamic_slot_object.fy +21 -3
  54. data/lib/enumerable.fy +140 -4
  55. data/lib/enumerator.fy +1 -1
  56. data/lib/eval.fy +23 -9
  57. data/lib/exception.fy +16 -0
  58. data/lib/false_class.fy +36 -5
  59. data/lib/fancy_spec.fy +64 -34
  60. data/lib/fdoc.fy +85 -24
  61. data/lib/file.fy +19 -0
  62. data/lib/future.fy +4 -46
  63. data/lib/hash.fy +113 -0
  64. data/lib/integer.fy +25 -6
  65. data/lib/iteration.fy +3 -3
  66. data/lib/main.fy +5 -0
  67. data/lib/matchers.fy +79 -0
  68. data/lib/nil_class.fy +8 -0
  69. data/lib/object.fy +109 -18
  70. data/lib/option_parser.fy +118 -0
  71. data/lib/package/dependency.fy +4 -8
  72. data/lib/package/dependency_installer.fy +1 -1
  73. data/lib/package/handler.fy +6 -0
  74. data/lib/package/installer.fy +43 -16
  75. data/lib/package/list.fy +1 -2
  76. data/lib/package/specification.fy +5 -5
  77. data/lib/package/uninstaller.fy +9 -2
  78. data/lib/parser.fy +1 -3
  79. data/lib/parser/ext/ext.c +1 -0
  80. data/lib/parser/ext/lexer.lex +5 -0
  81. data/lib/parser/methods.fy +48 -46
  82. data/lib/proxies.fy +151 -0
  83. data/lib/rbx.fy +1 -0
  84. data/lib/rbx/actor.fy +16 -18
  85. data/lib/rbx/array.fy +18 -3
  86. data/lib/rbx/block.fy +1 -7
  87. data/lib/rbx/class.fy +54 -9
  88. data/lib/rbx/code_loader.fy +2 -5
  89. data/lib/rbx/compiled_method.fy +31 -0
  90. data/lib/rbx/debugger.fy +66 -0
  91. data/lib/rbx/directory.fy +8 -3
  92. data/lib/rbx/documentation.fy +1 -1
  93. data/lib/rbx/file.fy +22 -0
  94. data/lib/rbx/integer.fy +1 -1
  95. data/lib/rbx/match_data.fy +2 -1
  96. data/lib/rbx/method.fy +26 -0
  97. data/lib/rbx/object.fy +8 -3
  98. data/lib/rbx/regexp.fy +6 -3
  99. data/lib/rbx/string.fy +9 -1
  100. data/lib/rbx/stringio.fy +12 -0
  101. data/lib/rbx/symbol.fy +4 -0
  102. data/lib/stack.fy +1 -1
  103. data/lib/string.fy +34 -0
  104. data/lib/stringio.fy +1 -1
  105. data/lib/symbol.fy +6 -2
  106. data/lib/system.fy +15 -1
  107. data/lib/tuple.fy +5 -2
  108. data/lib/version.fy +1 -1
  109. data/ruby_lib/fdoc +2 -22
  110. data/tests/array.fy +3 -17
  111. data/tests/class.fy +312 -10
  112. data/tests/contracts.fy +51 -0
  113. data/tests/distributing_proxy.fy +28 -0
  114. data/tests/enumerable.fy +104 -1
  115. data/tests/exception.fy +35 -0
  116. data/tests/fixnum.fy +1 -1
  117. data/tests/hash.fy +81 -1
  118. data/tests/integer.fy +9 -0
  119. data/tests/matchers.fy +18 -0
  120. data/tests/method.fy +8 -14
  121. data/tests/object.fy +76 -2
  122. data/tests/option_parser.fy +80 -0
  123. data/tests/string.fy +21 -0
  124. data/tests/stringio.fy +1 -1
  125. data/tests/tuple.fy +1 -1
  126. metadata +21 -44
  127. data/examples/arithmetic.fy +0 -7
  128. data/examples/array.fy +0 -50
  129. data/examples/boolean.fy +0 -24
  130. data/examples/class.fy +0 -68
  131. data/examples/constant_access.fy +0 -15
  132. data/examples/default_args.fy +0 -20
  133. data/examples/define_methods.fy +0 -15
  134. data/examples/dynamic_output.fy +0 -15
  135. data/examples/empty_catch.fy +0 -4
  136. data/examples/exception.fy +0 -9
  137. data/examples/files.fy +0 -23
  138. data/examples/finally.fy +0 -5
  139. data/examples/future.fy +0 -30
  140. data/examples/future_composition.fy +0 -20
  141. data/examples/futures.fy +0 -9
  142. data/examples/game_of_life.fy +0 -148
  143. data/examples/html_generator.fy +0 -84
  144. data/examples/implicit_return.fy +0 -3
  145. data/examples/matchers.fy +0 -6
  146. data/examples/nested_try.fy +0 -9
  147. data/examples/numbers.fy +0 -12
  148. data/examples/rbx/and_or.fy +0 -7
  149. data/examples/rbx/blocks.fy +0 -22
  150. data/examples/rbx/classes.fy +0 -32
  151. data/examples/rbx/hello.fy +0 -8
  152. data/examples/rbx/include.fy +0 -12
  153. data/examples/rbx/inherit.fy +0 -11
  154. data/examples/rbx/methods.fy +0 -15
  155. data/examples/rbx/nested_classes.fy +0 -9
  156. data/examples/rbx/require.fy +0 -3
  157. data/examples/rbx/strings.fy +0 -5
  158. data/examples/require.fy +0 -7
  159. data/examples/return.fy +0 -13
  160. data/examples/singleton_methods.fy +0 -21
  161. data/examples/threads.fy +0 -18
  162. data/examples/tuple.fy +0 -8
  163. data/examples/webserver/webserver.fy +0 -15
  164. data/lib/proxy.fy +0 -86
  165. data/lib/thread_pool.fy +0 -102
@@ -8,7 +8,7 @@ require: "compiler/ast"
8
8
 
9
9
  require: "parser"
10
10
 
11
- if: (ARGV main?: __FILE__) then: {
11
+ __FILE__ if_main: {
12
12
  require: "compiler/command"
13
13
  Fancy Compiler Command run: (ARGV rest)
14
14
  }
@@ -1,7 +1,6 @@
1
1
  class Fancy AST {
2
2
  class Assignment : Node {
3
- def initialize: @line var: @lvalue value: @rvalue {
4
- }
3
+ def initialize: @line var: @lvalue value: @rvalue
5
4
 
6
5
  def bytecode: g {
7
6
  pos(g)
@@ -11,8 +10,7 @@ class Fancy AST {
11
10
 
12
11
  class MultipleAssignment : Node {
13
12
  class MultipleAssignmentExpr : Node {
14
- def initialize: @line index: @index {
15
- }
13
+ def initialize: @line index: @index
16
14
 
17
15
  def bytecode: g {
18
16
  pos(g)
@@ -24,8 +22,7 @@ class Fancy AST {
24
22
  }
25
23
 
26
24
  class SplatAssignmentExpr : Node {
27
- def initialize: @line start_index: @start_index {
28
- }
25
+ def initialize: @line start_index: @start_index
29
26
 
30
27
  def bytecode: g {
31
28
  pos(g)
@@ -36,8 +33,7 @@ class Fancy AST {
36
33
  }
37
34
  }
38
35
 
39
- def initialize: @line var: @idents value: @values {
40
- }
36
+ def initialize: @line var: @idents value: @values
41
37
 
42
38
  def bytecode: g {
43
39
  pos(g)
@@ -1,7 +1,6 @@
1
1
  class Fancy AST {
2
2
  class AsyncSend : Node {
3
- def initialize: @line message_send: @message_send {
4
- }
3
+ def initialize: @line message_send: @message_send
5
4
 
6
5
  def bytecode: g {
7
6
  pos(g)
@@ -5,14 +5,19 @@ class Fancy AST {
5
5
  if: (@body empty?) then: {
6
6
  @body unshift_expression: $ NilLiteral new: @line
7
7
  }
8
+
8
9
  initialize(@line, @args, @body)
10
+
9
11
  @args create_locals: self
12
+
10
13
  if: (@args total_args == 0) then: {
11
14
  @arguments prelude=(nil)
12
15
  }
16
+
13
17
  if: (@args.total_args > 1) then: {
14
18
  @arguments prelude=('multi)
15
19
  }
20
+
16
21
  @arguments required_args=(@args required_args)
17
22
 
18
23
  if: @partial then: {
@@ -3,6 +3,7 @@ class Fancy AST {
3
3
  def initialize: @line name: @name parent: @parent body: @body (ExpressionList new: @line) {
4
4
  { @body = ExpressionList new: @line } unless: @body
5
5
  name = nil
6
+
6
7
  if: (@name is_a?: NestedConstant) then: {
7
8
  name = @name scoped
8
9
  } else: {
@@ -19,7 +20,7 @@ class Fancy AST {
19
20
  def bytecode: g {
20
21
  pos(g)
21
22
  docstring = body() body() docstring
22
- docstring if_true: {
23
+ if: docstring then: {
23
24
  setdoc = MessageSend new: @line \
24
25
  message: (Identifier from: "for:append:" line: @line) \
25
26
  to: (Identifier from: "Fancy::Documentation" line: @line) \
@@ -2,8 +2,7 @@ class Fancy AST {
2
2
  class ExpressionList : Node {
3
3
  read_slot: 'expressions
4
4
 
5
- def initialize: @line list: @expressions ([]) {
6
- }
5
+ def initialize: @line list: @expressions ([]);
7
6
 
8
7
  def unshift_expression: expression {
9
8
  @expressions unshift(expression)
@@ -1,7 +1,6 @@
1
1
  class Fancy AST {
2
2
  class FutureSend : Node {
3
- def initialize: @line message_send: @message_send {
4
- }
3
+ def initialize: @line message_send: @message_send
5
4
 
6
5
  def bytecode: g {
7
6
  pos(g)
@@ -1,6 +1,6 @@
1
1
  class Fancy AST {
2
2
  class Identifier : Node {
3
- read_slots: ['string, 'line]
3
+ read_slots: ('string, 'line)
4
4
  read_write_slot: 'ruby_ident
5
5
 
6
6
  @@gen_ident_start = 0
@@ -24,17 +24,17 @@ class Fancy AST {
24
24
  }
25
25
 
26
26
  def name {
27
- @string to_sym()
27
+ @string to_sym
28
28
  }
29
29
 
30
30
  def method_name: receiver ruby_send: ruby (false) {
31
- ruby || @ruby_ident if_true: {
32
- @string to_sym()
31
+ if: (ruby || @ruby_ident) then: {
32
+ @string to_sym
33
33
  } else: {
34
- @string =~ /:$/ . if_true: {
35
- @string to_sym()
34
+ if: (@string =~ /:$/) then: {
35
+ @string to_sym
36
36
  } else: {
37
- ":" + @string . to_sym()
37
+ ":" + @string . to_sym
38
38
  }
39
39
  }
40
40
  }
@@ -44,11 +44,12 @@ class Fancy AST {
44
44
  case "__FILE__" -> return CurrentFile new: line filename: filename
45
45
  case "__LINE__" -> return CurrentLine new: line
46
46
  case "self" -> return Self new: line
47
+ case /^::/ -> ToplevelConstant
47
48
  case /^[A-Z].*::/ -> NestedConstant
48
49
  case /^[A-Z]/ -> Constant
49
50
  case /^@@/ -> ClassVariable
50
51
  case /^@/ -> InstanceVariable
51
- case /^\*/ -> DynamicVariable
52
+ case /^\*[a-zA-Z0-9_-]+\*$/ -> DynamicVariable
52
53
  case _ -> Identifier
53
54
  }
54
55
  type new: line string: string
@@ -72,7 +73,7 @@ class Fancy AST {
72
73
  }
73
74
 
74
75
  class InstanceVariable : Identifier {
75
- def initialize: @line string: @string {}
76
+ def initialize: @line string: @string
76
77
  def bytecode: g {
77
78
  pos(g)
78
79
  Rubinius AST InstanceVariableAccess new(@line, name) bytecode(g)
@@ -80,7 +81,7 @@ class Fancy AST {
80
81
  }
81
82
 
82
83
  class ClassVariable : Identifier {
83
- def initialize: @line string: @string {}
84
+ def initialize: @line string: @string
84
85
  def bytecode: g {
85
86
  pos(g)
86
87
  Rubinius AST ClassVariableAccess new(@line, name) bytecode(g)
@@ -88,7 +89,7 @@ class Fancy AST {
88
89
  }
89
90
 
90
91
  class Constant : Identifier {
91
- def initialize: @line string: @string {}
92
+ def initialize: @line string: @string
92
93
  def bytecode: g {
93
94
  pos(g)
94
95
  Rubinius AST ConstantAccess new(@line, name) bytecode(g)
@@ -96,19 +97,25 @@ class Fancy AST {
96
97
  }
97
98
 
98
99
  class NestedConstant : Identifier {
99
- def initialize: @line string: @string {
100
- }
100
+ def initialize: @line string: @string
101
101
 
102
102
  def initialize: @line const: const parent: parent {
103
103
  @string = (parent string) ++ "::" ++ (const string)
104
104
  }
105
105
 
106
106
  def scoped {
107
- names = @string split("::")
108
- parent = Constant new: @line string: (names shift())
107
+ names = @string split: "::"
108
+ parent = nil
109
+ match @string {
110
+ case /^::/ ->
111
+ names = names rest
112
+ parent = ToplevelConstant new: @line string: "::#{names shift}"
113
+ case _ ->
114
+ parent = Constant new: @line string: $ names shift
115
+ }
109
116
  scoped = nil
110
- names each() |name| {
111
- scoped = Rubinius AST ScopedConstant new(@line, parent, name to_sym())
117
+ names each: |name| {
118
+ scoped = Rubinius AST ScopedConstant new(@line, parent, name to_sym)
112
119
  parent = scoped
113
120
  }
114
121
  scoped
@@ -120,6 +127,16 @@ class Fancy AST {
120
127
  }
121
128
  }
122
129
 
130
+ class ToplevelConstant : Identifier {
131
+ def initialize: @line string: @string
132
+
133
+ def bytecode: g {
134
+ pos(g)
135
+ const_name = @string from: 2 to: -1 . to_sym # skip leading ::
136
+ Rubinius AST ToplevelConstant new(@line, const_name) . bytecode(g)
137
+ }
138
+ }
139
+
123
140
  class DynamicVariable : Identifier {
124
141
  read_slot: 'varname
125
142
  def initialize: @line string: @string {
@@ -1,6 +1,8 @@
1
1
  class Fancy AST {
2
2
  class NilLiteral : Rubinius AST NilLiteral {
3
- def initialize: line { initialize(line) }
3
+ def initialize: line {
4
+ initialize(line)
5
+ }
4
6
  def bytecode: g {
5
7
  pos(g)
6
8
  bytecode(g)
@@ -8,7 +10,9 @@ class Fancy AST {
8
10
  }
9
11
 
10
12
  class FixnumLiteral : Rubinius AST FixnumLiteral {
11
- def initialize: line value: value { initialize(line, value) }
13
+ def initialize: line value: value {
14
+ initialize(line, value)
15
+ }
12
16
  def bytecode: g {
13
17
  pos(g)
14
18
  bytecode(g)
@@ -16,7 +20,9 @@ class Fancy AST {
16
20
  }
17
21
 
18
22
  class NumberLiteral : Rubinius AST NumberLiteral {
19
- def initialize: line value: value { initialize(line, value) }
23
+ def initialize: line value: value {
24
+ initialize(line, value)
25
+ }
20
26
  def bytecode: g {
21
27
  pos(g)
22
28
  bytecode(g)
@@ -24,7 +30,9 @@ class Fancy AST {
24
30
  }
25
31
 
26
32
  class StringLiteral : Rubinius AST StringLiteral {
27
- def initialize: line value: value { initialize(line, StringHelper unescape_string(value)) }
33
+ def initialize: line value: value {
34
+ initialize(line, StringHelper unescape_string(value))
35
+ }
28
36
  def bytecode: g {
29
37
  pos(g)
30
38
  bytecode(g)
@@ -32,19 +40,15 @@ class Fancy AST {
32
40
  }
33
41
 
34
42
  class CurrentFile : Node {
35
- def initialize: @line filename: @filename { }
43
+ def initialize: @line filename: @filename
36
44
  def bytecode: g {
37
45
  pos(g)
38
- args = MessageArgs new: @line args: [StringLiteral new: @line value: @filename]
39
- MessageSend new: @line message: (Identifier from: "current_file:" line: @line) \
40
- to: (Identifier from: "Fancy::CodeLoader" line: @line) \
41
- args: args .
42
- bytecode: g
46
+ StringLiteral new: @line value: $ File absolute_path: @filename . bytecode: g
43
47
  }
44
48
  }
45
49
 
46
50
  class CurrentLine : Node {
47
- def initialize: @line { }
51
+ def initialize: @line
48
52
  def bytecode: g {
49
53
  pos(g)
50
54
  FixnumLiteral new: @line value: @line . bytecode: g
@@ -52,12 +56,12 @@ class Fancy AST {
52
56
  }
53
57
 
54
58
  class Nothing : Node {
55
- def initialize: @line { }
59
+ def initialize: @line
56
60
  def bytecode: g { pos(g) }
57
61
  }
58
62
 
59
63
  class StackTop : Node {
60
- def initialize: @line { }
64
+ def initialize: @line
61
65
  def bytecode: g {
62
66
  pos(g)
63
67
  g dup()
@@ -65,8 +69,10 @@ class Fancy AST {
65
69
  }
66
70
 
67
71
  class StackLocal : Node {
68
- def initialize: @line { }
69
- def set: g { @local = g new_stack_local(); g set_stack_local(@local) }
72
+ def initialize: @line
73
+ def set: g {
74
+ @local = g new_stack_local(); g set_stack_local(@local)
75
+ }
70
76
  def bytecode: g {
71
77
  pos(g)
72
78
  g push_stack_local(@local)
@@ -74,7 +80,9 @@ class Fancy AST {
74
80
  }
75
81
 
76
82
  class Self : Rubinius AST Self {
77
- def initialize: line { initialize(line) }
83
+ def initialize: line {
84
+ initialize(line)
85
+ }
78
86
  def bytecode: g {
79
87
  pos(g)
80
88
  bytecode(g)
@@ -90,7 +98,9 @@ class Fancy AST {
90
98
 
91
99
  class SymbolLiteral : Rubinius AST SymbolLiteral {
92
100
  read_slot: 'value
93
- def initialize: line value: value { initialize(line, value) }
101
+ def initialize: line value: value {
102
+ initialize(line, value)
103
+ }
94
104
  def string {
95
105
  value
96
106
  }
@@ -101,7 +111,9 @@ class Fancy AST {
101
111
  }
102
112
 
103
113
  class RegexpLiteral : Rubinius AST RegexLiteral {
104
- def initialize: line value: value { initialize(line, value, 0) }
114
+ def initialize: line value: value {
115
+ initialize(line, value, 0)
116
+ }
105
117
  def bytecode: g {
106
118
  pos(g)
107
119
  bytecode(g)
@@ -109,7 +121,7 @@ class Fancy AST {
109
121
  }
110
122
 
111
123
  class ArrayLiteral : Rubinius AST ArrayLiteral {
112
- read_slots: ['array]
124
+ read_slot: 'array
113
125
  def initialize: line array: @array {
114
126
  @array if_nil: { @array = [] }
115
127
  initialize(line, @array)
@@ -1,10 +1,11 @@
1
1
  class Fancy AST {
2
2
  class Match : Node {
3
- def initialize: @line expr: @expr body: @clauses {
4
- }
3
+ def initialize: @line expr: @expr body: @clauses
5
4
 
6
5
  def bytecode: g set_match_args: clause {
7
- "Generates bytecode for setting match clause arguments, if needed"
6
+ """
7
+ Generates bytecode for setting match clause arguments, if needed.
8
+ """
8
9
 
9
10
  g dup()
10
11
  skip_create_locals_label = g new_label()
@@ -94,7 +95,7 @@ class Fancy AST {
94
95
  }
95
96
 
96
97
  class MatchClause : Node {
97
- read_slots: ['expr, 'body, 'match_args]
98
+ read_slots: ('expr, 'body, 'match_args)
98
99
 
99
100
  def initialize: @line expr: @expr body: @body args: @match_args {
100
101
  if: (@expr kind_of?: Identifier) then: {
@@ -1,6 +1,6 @@
1
1
  class Fancy AST {
2
2
  class MessageSend : Node {
3
- read_write_slots: ['name, 'receiver, 'args]
3
+ read_write_slots: ('name, 'receiver, 'args)
4
4
 
5
5
  # fast instructions to be used if possible
6
6
  FastOps = <[
@@ -12,8 +12,7 @@ class Fancy AST {
12
12
  ':> => 'meta_send_op_gt
13
13
  ]>
14
14
 
15
- def initialize: @line message: @name to: @receiver (Self new: @line) args: @args (MessageArgs new: @line) {
16
- }
15
+ def initialize: @line message: @name to: @receiver (Self new: @line) args: @args (MessageArgs new: @line);
17
16
 
18
17
  def redirect_via: redirect_message {
19
18
  message_name = SymbolLiteral new: @line value: (@name string to_sym)
@@ -96,8 +95,7 @@ class Fancy AST {
96
95
  class MessageArgs : Node {
97
96
  read_slot: 'args
98
97
 
99
- def initialize: @line args: @args ([]) {
100
- }
98
+ def initialize: @line args: @args ([]);
101
99
 
102
100
  def bytecode: g {
103
101
  pos(g)
@@ -24,9 +24,6 @@ class Fancy AST {
24
24
 
25
25
  def bytecode: g {
26
26
  pos(g)
27
- g push_self()
28
- g send(@access, 0)
29
- g pop()
30
27
 
31
28
  @name to_s =~ /^initialize:(\S)+/ if_true: {
32
29
  define_constructor_class_method: g
@@ -1,9 +1,7 @@
1
1
  class Fancy AST {
2
2
  class RangeLiteral : Node {
3
- read_slots: ['from, 'to]
4
-
5
- def initialize: @line from: @from to: @to {
6
- }
3
+ read_slots: ('from, 'to)
4
+ def initialize: @line from: @from to: @to
7
5
 
8
6
  def bytecode: g {
9
7
  pos(g)
@@ -1,7 +1,6 @@
1
1
  class Fancy AST {
2
2
  class Return : Node {
3
- def initialize: @line expr: @expr {
4
- }
3
+ def initialize: @line expr: @expr
5
4
 
6
5
  def bytecode: g {
7
6
  pos(g)
@@ -11,8 +10,7 @@ class Fancy AST {
11
10
  }
12
11
 
13
12
  class ReturnLocal : Node {
14
- def initialize: @line expr: @expr {
15
- }
13
+ def initialize: @line expr: @expr
16
14
 
17
15
  def bytecode: g {
18
16
  pos(g)