opal 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +1 -0
  3. data/.github/workflows/build.yml +0 -3
  4. data/.rubocop.yml +5 -1
  5. data/CHANGELOG.md +106 -5
  6. data/UNRELEASED.md +3 -1
  7. data/benchmark-ips/bm_truthy.rb +30 -0
  8. data/bin/opal-mspec +1 -3
  9. data/bin/opal-repl +1 -2
  10. data/bin/remove-filters +1 -4
  11. data/docs/compiled_ruby.md +37 -22
  12. data/docs/faq.md +1 -1
  13. data/docs/headless_chrome.md +11 -21
  14. data/docs/jquery.md +1 -6
  15. data/docs/opal_parser.md +3 -1
  16. data/docs/promises.md +2 -0
  17. data/docs/releasing.md +19 -1
  18. data/docs/roda-sprockets.md +0 -1
  19. data/docs/source_maps.md +10 -11
  20. data/docs/static_applications.md +2 -2
  21. data/docs/unsupported_features.md +4 -0
  22. data/exe/opal-repl +1 -3
  23. data/lib/opal/ast/builder.rb +1 -1
  24. data/lib/opal/cli.rb +2 -2
  25. data/lib/opal/cli_runners/chrome.rb +4 -4
  26. data/lib/opal/cli_runners/nodejs.rb +9 -2
  27. data/lib/opal/cli_runners/source-map-support-browser.js +80 -216
  28. data/lib/opal/cli_runners/source-map-support-node.js +80 -216
  29. data/lib/opal/cli_runners/source-map-support.js +5 -1
  30. data/lib/opal/cli_runners/system_runner.rb +10 -4
  31. data/lib/opal/compiler.rb +3 -5
  32. data/lib/opal/fragment.rb +5 -1
  33. data/lib/opal/nodes/args/extract_block_arg.rb +1 -8
  34. data/lib/opal/nodes/args/extract_kwoptarg.rb +1 -3
  35. data/lib/opal/nodes/args/extract_optarg.rb +1 -3
  36. data/lib/opal/nodes/args/extract_post_arg.rb +2 -5
  37. data/lib/opal/nodes/args/extract_post_optarg.rb +2 -7
  38. data/lib/opal/nodes/args/initialize_iterarg.rb +1 -3
  39. data/lib/opal/nodes/args/prepare_post_args.rb +5 -1
  40. data/lib/opal/nodes/base.rb +3 -2
  41. data/lib/opal/nodes/call.rb +24 -11
  42. data/lib/opal/nodes/call_special.rb +50 -0
  43. data/lib/opal/nodes/class.rb +24 -15
  44. data/lib/opal/nodes/constants.rb +23 -5
  45. data/lib/opal/nodes/def.rb +20 -23
  46. data/lib/opal/nodes/defined.rb +5 -5
  47. data/lib/opal/nodes/definitions.rb +2 -2
  48. data/lib/opal/nodes/defs.rb +2 -5
  49. data/lib/opal/nodes/helpers.rb +48 -18
  50. data/lib/opal/nodes/if.rb +113 -8
  51. data/lib/opal/nodes/iter.rb +23 -16
  52. data/lib/opal/nodes/literal.rb +18 -4
  53. data/lib/opal/nodes/logic.rb +2 -1
  54. data/lib/opal/nodes/masgn.rb +4 -9
  55. data/lib/opal/nodes/module.rb +29 -19
  56. data/lib/opal/nodes/node_with_args.rb +1 -7
  57. data/lib/opal/nodes/scope.rb +54 -15
  58. data/lib/opal/nodes/singleton_class.rb +5 -3
  59. data/lib/opal/nodes/super.rb +3 -3
  60. data/lib/opal/nodes/top.rb +34 -31
  61. data/lib/opal/nodes/variables.rb +2 -2
  62. data/lib/opal/nodes/x_string.rb +30 -28
  63. data/lib/opal/nodes.rb +0 -1
  64. data/lib/opal/parser/patch.rb +75 -0
  65. data/lib/opal/parser/with_ruby_lexer.rb +1 -1
  66. data/lib/opal/regexp_anchors.rb +7 -7
  67. data/lib/opal/repl.rb +2 -1
  68. data/lib/opal/requires.rb +19 -0
  69. data/lib/opal/rewriters/pattern_matching.rb +1 -1
  70. data/lib/opal/rewriters/returnable_logic.rb +102 -4
  71. data/lib/opal/util.rb +2 -2
  72. data/lib/opal/version.rb +1 -1
  73. data/lib/opal.rb +1 -17
  74. data/opal/corelib/array/pack.rb +11 -11
  75. data/opal/corelib/array.rb +194 -153
  76. data/opal/corelib/basic_object.rb +19 -15
  77. data/opal/corelib/binding.rb +11 -7
  78. data/opal/corelib/boolean.rb +12 -15
  79. data/opal/corelib/class.rb +23 -1
  80. data/opal/corelib/comparable.rb +8 -8
  81. data/opal/corelib/complex/base.rb +2 -2
  82. data/opal/corelib/complex.rb +79 -88
  83. data/opal/corelib/constants.rb +9 -9
  84. data/opal/corelib/dir.rb +4 -3
  85. data/opal/corelib/enumerable.rb +140 -127
  86. data/opal/corelib/enumerator/arithmetic_sequence.rb +177 -0
  87. data/opal/corelib/enumerator/chain.rb +42 -0
  88. data/opal/corelib/enumerator/generator.rb +35 -0
  89. data/opal/corelib/enumerator/lazy.rb +243 -0
  90. data/opal/corelib/enumerator/yielder.rb +36 -0
  91. data/opal/corelib/enumerator.rb +45 -300
  92. data/opal/corelib/error/errno.rb +47 -0
  93. data/opal/corelib/error.rb +62 -60
  94. data/opal/corelib/file.rb +26 -12
  95. data/opal/corelib/hash.rb +98 -107
  96. data/opal/corelib/helpers.rb +62 -13
  97. data/opal/corelib/io.rb +48 -35
  98. data/opal/corelib/kernel/format.rb +29 -29
  99. data/opal/corelib/kernel.rb +86 -83
  100. data/opal/corelib/main.rb +14 -12
  101. data/opal/corelib/marshal/read_buffer.rb +15 -15
  102. data/opal/corelib/marshal/write_buffer.rb +45 -44
  103. data/opal/corelib/marshal.rb +3 -3
  104. data/opal/corelib/math.rb +50 -50
  105. data/opal/corelib/method.rb +12 -8
  106. data/opal/corelib/module.rb +79 -75
  107. data/opal/corelib/nil.rb +9 -11
  108. data/opal/corelib/number.rb +113 -118
  109. data/opal/corelib/numeric.rb +37 -33
  110. data/opal/corelib/object_space.rb +11 -10
  111. data/opal/corelib/pack_unpack/format_string_parser.rb +3 -3
  112. data/opal/corelib/pattern_matching/base.rb +7 -7
  113. data/opal/corelib/pattern_matching.rb +1 -1
  114. data/opal/corelib/proc.rb +17 -15
  115. data/opal/corelib/process/base.rb +2 -2
  116. data/opal/corelib/process/status.rb +21 -0
  117. data/opal/corelib/process.rb +5 -5
  118. data/opal/corelib/random/formatter.rb +11 -11
  119. data/opal/corelib/random/math_random.js.rb +1 -1
  120. data/opal/corelib/random/mersenne_twister.rb +3 -3
  121. data/opal/corelib/random/seedrandom.js.rb +3 -3
  122. data/opal/corelib/random.rb +17 -17
  123. data/opal/corelib/range.rb +51 -35
  124. data/opal/corelib/rational/base.rb +4 -4
  125. data/opal/corelib/rational.rb +61 -62
  126. data/opal/corelib/regexp.rb +54 -45
  127. data/opal/corelib/runtime.js +247 -141
  128. data/opal/corelib/string/encoding.rb +21 -21
  129. data/opal/corelib/string/unpack.rb +19 -14
  130. data/opal/corelib/string.rb +138 -131
  131. data/opal/corelib/struct.rb +59 -46
  132. data/opal/corelib/time.rb +47 -57
  133. data/opal/corelib/trace_point.rb +2 -2
  134. data/opal/corelib/unsupported.rb +31 -120
  135. data/opal/corelib/variables.rb +3 -3
  136. data/opal/opal/base.rb +9 -8
  137. data/opal/opal/full.rb +8 -8
  138. data/opal/opal/mini.rb +17 -17
  139. data/opal/opal.rb +17 -18
  140. data/opal.gemspec +1 -1
  141. data/spec/filters/bugs/array.rb +4 -24
  142. data/spec/filters/bugs/basicobject.rb +0 -1
  143. data/spec/filters/bugs/bigdecimal.rb +0 -23
  144. data/spec/filters/bugs/binding.rb +0 -1
  145. data/spec/filters/bugs/boolean.rb +3 -0
  146. data/spec/filters/bugs/class.rb +2 -0
  147. data/spec/filters/bugs/date.rb +0 -5
  148. data/spec/filters/bugs/encoding.rb +8 -50
  149. data/spec/filters/bugs/enumerable.rb +4 -1
  150. data/spec/filters/bugs/enumerator.rb +3 -36
  151. data/spec/filters/bugs/exception.rb +0 -2
  152. data/spec/filters/bugs/file.rb +0 -2
  153. data/spec/filters/bugs/float.rb +0 -3
  154. data/spec/filters/bugs/hash.rb +5 -3
  155. data/spec/filters/bugs/integer.rb +2 -3
  156. data/spec/filters/bugs/kernel.rb +4 -31
  157. data/spec/filters/bugs/language.rb +29 -49
  158. data/spec/filters/bugs/main.rb +0 -2
  159. data/spec/filters/bugs/marshal.rb +2 -3
  160. data/spec/filters/bugs/matrix.rb +0 -36
  161. data/spec/filters/bugs/module.rb +7 -61
  162. data/spec/filters/bugs/numeric.rb +0 -7
  163. data/spec/filters/bugs/objectspace.rb +1 -1
  164. data/spec/filters/bugs/pack_unpack.rb +0 -4
  165. data/spec/filters/bugs/proc.rb +0 -9
  166. data/spec/filters/bugs/random.rb +0 -5
  167. data/spec/filters/bugs/range.rb +1 -6
  168. data/spec/filters/bugs/regexp.rb +0 -3
  169. data/spec/filters/bugs/set.rb +8 -1
  170. data/spec/filters/bugs/string.rb +9 -34
  171. data/spec/filters/bugs/stringscanner.rb +8 -7
  172. data/spec/filters/bugs/struct.rb +2 -3
  173. data/spec/filters/bugs/symbol.rb +0 -1
  174. data/spec/filters/bugs/time.rb +0 -8
  175. data/spec/filters/bugs/unboundmethod.rb +0 -8
  176. data/spec/filters/bugs/warnings.rb +1 -7
  177. data/spec/filters/unsupported/freeze.rb +24 -0
  178. data/spec/filters/unsupported/integer.rb +1 -0
  179. data/spec/filters/unsupported/kernel.rb +12 -0
  180. data/spec/filters/unsupported/privacy.rb +3 -0
  181. data/spec/filters/unsupported/string.rb +2 -0
  182. data/spec/lib/builder_spec.rb +2 -2
  183. data/spec/lib/cli_spec.rb +1 -1
  184. data/spec/lib/compiler_spec.rb +37 -37
  185. data/spec/lib/simple_server_spec.rb +2 -2
  186. data/spec/lib/source_map/file_spec.rb +1 -1
  187. data/spec/opal/compiler/irb_spec.rb +2 -2
  188. data/spec/opal/core/array/zip_spec.rb +12 -0
  189. data/spec/opal/core/io/read_spec.rb +69 -0
  190. data/spec/opal/core/kernel/puts_spec.rb +90 -0
  191. data/spec/opal/core/language/xstring_spec.rb +13 -0
  192. data/spec/opal/core/language_spec.rb +14 -0
  193. data/spec/opal/core/string/gsub_spec.rb +8 -0
  194. data/spec/opal/core/string/scan_spec.rb +8 -0
  195. data/spec/ruby_specs +4 -2
  196. data/spec/support/rewriters_helper.rb +1 -1
  197. data/stdlib/bigdecimal.rb +7 -11
  198. data/stdlib/buffer/view.rb +2 -2
  199. data/stdlib/buffer.rb +2 -2
  200. data/stdlib/date.rb +5 -6
  201. data/stdlib/erb.rb +1 -0
  202. data/stdlib/js.rb +2 -1
  203. data/stdlib/native.rb +7 -8
  204. data/stdlib/nodejs/argf.rb +4 -4
  205. data/stdlib/nodejs/base.rb +29 -0
  206. data/stdlib/nodejs/dir.rb +1 -1
  207. data/stdlib/nodejs/env.rb +6 -9
  208. data/stdlib/nodejs/file.rb +23 -17
  209. data/stdlib/nodejs/fileutils.rb +3 -3
  210. data/stdlib/nodejs/io.rb +2 -20
  211. data/stdlib/nodejs/irb.rb +0 -0
  212. data/stdlib/nodejs/kernel.rb +2 -37
  213. data/stdlib/nodejs.rb +1 -3
  214. data/stdlib/opal/miniracer.rb +2 -0
  215. data/stdlib/opal/platform.rb +6 -13
  216. data/stdlib/opal/replutils.rb +16 -5
  217. data/stdlib/opal-parser.rb +2 -2
  218. data/stdlib/optparse/ac.rb +54 -0
  219. data/stdlib/optparse/date.rb +14 -0
  220. data/stdlib/optparse/kwargs.rb +22 -0
  221. data/stdlib/optparse/shellwords.rb +7 -0
  222. data/stdlib/optparse/time.rb +15 -0
  223. data/stdlib/optparse/uri.rb +7 -0
  224. data/stdlib/optparse/version.rb +69 -0
  225. data/stdlib/optparse.rb +2279 -0
  226. data/stdlib/pathname.rb +5 -6
  227. data/stdlib/pp.rb +18 -2
  228. data/stdlib/promise/v2.rb +18 -22
  229. data/stdlib/promise.rb +15 -21
  230. data/stdlib/quickjs/io.rb +0 -2
  231. data/stdlib/quickjs/kernel.rb +0 -2
  232. data/stdlib/quickjs.rb +2 -0
  233. data/stdlib/set.rb +32 -32
  234. data/stdlib/shellwords.rb +240 -0
  235. data/stdlib/stringio.rb +3 -6
  236. data/stdlib/strscan.rb +5 -8
  237. data/stdlib/template.rb +2 -2
  238. data/stdlib/thread.rb +7 -9
  239. data/tasks/linting-parse-eslint-results.js +1 -0
  240. data/tasks/linting.rake +0 -10
  241. data/tasks/performance.rake +5 -2
  242. data/tasks/testing/mspec_special_calls.rb +0 -12
  243. data/tasks/testing.rake +55 -37
  244. data/test/nodejs/test_file.rb +11 -0
  245. metadata +56 -8
  246. data/lib/opal/nodes/case.rb +0 -114
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b7a4b076832e2c4f5cf807f40bf1a9d7e1a0328e1ef4b245f1514ae2ff145dd
4
- data.tar.gz: 5df94eda8d910641c918d913b7421796b5e513b05600e51d1debd0cd3944cf20
3
+ metadata.gz: ec2d9bb3f02059898f9a494c018fbcb4f451c4c5130b3e9ff455bf3ce1561fc9
4
+ data.tar.gz: a69e0554d43a0ef0ad6e7d439beb313536227615698487b8283321e879cf150d
5
5
  SHA512:
6
- metadata.gz: 04050f1589cf7ee4a3be39907e4618434659157968b63f225c6ae27a46da5f9e77c57080ca0c741aa333c3a3e48e2bbe38a3719f8540e55aefe26a3b6c4d3710
7
- data.tar.gz: 867a69aa3810572ff1636f4b6dc0df14435fa54dc06655101dde8017e71ab1892393e5a61517194f4828d596301097876e36734d9c4039f2d2109c70a011a3cb
6
+ metadata.gz: 5a96aade4e8183b8f00136eb4c5e64ea1f6b12b03aec98096476de4dd414b03b9ecfb90658a29bef403b366e36db43283b6e175cac5dcc3796453535f9ad7bd0
7
+ data.tar.gz: 8ea23169b1492a34b5bf98750259f9d9da636bb5070b50fad624a56a2eea65f4c5975a6385af3dfbdfad2a41985f5d32ba3aa583feea39b79b59ccc3cac20c43
data/.eslintrc.js CHANGED
@@ -30,5 +30,6 @@ module.exports = {
30
30
  "globalThis": "readonly",
31
31
  "Uint8Array": "readonly",
32
32
  "Promise": "readonly",
33
+ "WeakRef": "readonly",
33
34
  }
34
35
  };
@@ -71,9 +71,6 @@ jobs:
71
71
  uses: ruby/setup-ruby@v1
72
72
  with:
73
73
  ruby-version: ${{ matrix.combo.ruby }}
74
- # NOTE: Bundler 2.2.0 fails to install libv8
75
- # https://github.com/rubyjs/libv8/issues/310
76
- bundler: "2.1.4"
77
74
  bundler-cache: false
78
75
  - run: ruby bin/git-submodule-fast-install
79
76
  - run: bundle lock
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ require: rubocop-performance
2
2
  inherit_from: .rubocop/todo.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.5
5
+ TargetRubyVersion: 2.6
6
6
  Exclude:
7
7
  - CHANGELOG.md
8
8
  - CONDUCT.md
@@ -52,6 +52,10 @@ AllCops:
52
52
  - 'stdlib/matrix/*.rb'
53
53
  - 'stdlib/pp.rb'
54
54
  - 'stdlib/prettyprint.rb'
55
+ - 'stdlib/optparse.rb'
56
+ - 'stdlib/optparse/*.rb'
57
+ - 'stdlib/tmpdir.rb'
58
+ - 'stdlib/tempfile.rb'
55
59
 
56
60
  inherit_mode:
57
61
  merge:
data/CHANGELOG.md CHANGED
@@ -15,6 +15,111 @@ Changes are grouped as follows:
15
15
 
16
16
 
17
17
 
18
+ ## [1.4.0](https://github.com/opal/opal/compare/v1.3.2...v1.4.0) - 2021-12-24
19
+
20
+
21
+ ### Added
22
+
23
+ - Implement `chomp:` option for `String#each_line` and `#lines` ([#2355](https://github.com/opal/opal/pull/2355))
24
+ - Ruby 3.1 support and some older Ruby features we missed ([#2347](https://github.com/opal/opal/pull/2347))
25
+ - Use parser in 3.1 mode to support new language-level features like hashes/kwargs value omission, the pin operator for pattern matching
26
+ - `Array#intersect?`
27
+ - `String#strip` and `String#lstrip` to also remove NUL bytes
28
+ - `Integer.try_convert`
29
+ - `public`, `private`, `protected`, `module_function` now return their arguments
30
+ - `Class#descendants`, `Class#subclasses`
31
+ - (<=1.8) `Kernel#local_variables`
32
+ - (<=2.3) Set local variables for regexp named captures (`/(?<b>a)/ =~ 'a'` => `b = 'a'`)
33
+ - Remove deprecated `NIL`, `TRUE`, `FALSE` constants
34
+ - `String#unpack` and `String#unpack1` to support an `offset:` kwarg
35
+ - `MatchData#match`, `MatchData#match_length`
36
+ - Enumerable modernization
37
+ - `Enumerable#tally` to support an optional hash accumulator
38
+ - `Enumerable#each_{cons,slice}` to return self
39
+ - `Enumerable#compact`
40
+ - `Refinement` becomes its own class now
41
+ - `Struct#keyword_init?`
42
+ - (pre-3.1) Large Enumerator rework
43
+ - Introduce `Enumerator::ArithmeticSequence`
44
+ - Introduce `Enumerator::Chain`
45
+ - Introduce `Enumerator#+` to create `Enumerator::Chain`s
46
+ - `Enumerator#{rewind,peek,peek_values,next,next_values}`
47
+ - Improve corelib support for beginless/endless ranges and `ArithmeticSequences`
48
+ - `String#[]`, `Array#[]`, `Array#[]=`, `Array#fill`, `Array#values_at`
49
+ - `Range#step` and `Numeric#step` return an `ArithmeticSequence` when `Numeric` values are in play
50
+ - Introduce `Range#%`
51
+ - `Enumerator::Yielder#to_proc`
52
+ - Fix #2367
53
+ - (2.7) `UnboundMethod#bind_call`
54
+ - (Opal) `{Kernel,BasicObject}#{inspect,p,pp,method_missing}` may work with JS native values now, also they now correctly report cycles
55
+ - `Enumerable#sum` uses Kahan's summation algorithm to reduce error with floating point values
56
+ - `File.dirname` supports a new `level` argument
57
+ - Vendor in `optparse` and `shellwords` ([#2326](https://github.com/opal/opal/pull/2326))
58
+ - Preliminary support for compiling the whole `bin/opal` with Opal ([#2326](https://github.com/opal/opal/pull/2326))
59
+
60
+ ### Fixed
61
+
62
+ - Fix coertion for `Array#drop` ([#2371](https://github.com/opal/opal/pull/2371))
63
+ - Fix coertion for `File.absolute_path` ([#2372](https://github.com/opal/opal/pull/2372))
64
+ - Fix some `IO#puts` edge cases (no args, empty array, nested array, …) ([#2372](https://github.com/opal/opal/pull/2372))
65
+ - Preserve UNC path prefix on File.join ([#2366](https://github.com/opal/opal/pull/2366))
66
+ - Methods on `Kernel`, `BasicObject`, `Boolean` will never return boxed values anymore ([#2293](https://github.com/opal/opal/pull/2293))
67
+ - `false.tap{}` will now correctly return a JS value of `false`, not `Object(false)`
68
+ - opal-parser doesn't break on `<<~END` strings anymore ([#2364](https://github.com/opal/opal/pull/2364))
69
+ - Fix error reporting at the early stage of loading ([#2326](https://github.com/opal/opal/pull/2326))
70
+
71
+ ### Changed
72
+
73
+ - Various outputted code size optimizations - 19% improvement for minified unmangled AsciiDoctor bundle - see: https://opalrb.com/blog/2021/11/24/optimizing-opal-output-for-size/ ([#2356](https://github.com/opal/opal/pull/2356))
74
+ - Second round of code size optimizations - 3% improvement for AsciiDoctor bundle on top of the first round - 23% total - see: https://github.com/opal/opal/pull/2365/commits ([#2365](https://github.com/opal/opal/pull/2365))
75
+ - The calls to `==`, `!=` and `===` changed their semantics slightly: it's impossible to monkey patch those calls for `String` and `Number`, but on other classes they can now return `nil` and it will be handled correctly
76
+ - The calls to `!` changed their semantics slightly: it's impossible to monkey patch this call for `Boolean` or `NilClass`.
77
+ - Refactored the structure of the internal `stdlib/nodejs` folder ([#2374](https://github.com/opal/opal/pull/2374))
78
+ - Added `nodejs/base` with just I/O, exit, and ARGV management
79
+ - Moved `Process::Status` to corelib
80
+ - Fixed requires to be more robust
81
+
82
+ ### Removed
83
+
84
+ - Removed `nodejs/irb` from stdlib as it's been broken for some time ([#2374](https://github.com/opal/opal/pull/2374))
85
+ - Removed `Kernel#node_require` from `nodejs/kernel` as it's been deprecated for a long time ([#2374](https://github.com/opal/opal/pull/2374))
86
+
87
+ <!--
88
+ ### Deprecated
89
+ ### Internal
90
+ -->
91
+
92
+
93
+
94
+
95
+ ## [1.3.2](https://github.com/opal/opal/compare/v1.3.1...v1.3.2) - 2021-11-10
96
+
97
+
98
+ ### Fixed
99
+
100
+ - Update documentation ([#2350](https://github.com/opal/opal/pull/2350))
101
+ - Fix `IO#gets` getting an extra char under some circumstances ([#2349](https://github.com/opal/opal/pull/2349))
102
+ - Raise a `TypeError` instead of `UndefinedMethod` if not a string is passed to `__send__` ([#2346](https://github.com/opal/opal/pull/2346))
103
+ - Do not modify `$~` when calling `String#scan` from internal methods ([#2353](https://github.com/opal/opal/pull/2353))
104
+ - Stop interpreting falsey values as a missing constant in `Module#const_get` ([#2354](https://github.com/opal/opal/pull/2354))
105
+
106
+
107
+
108
+
109
+ ## [1.3.1](https://github.com/opal/opal/compare/v1.3.0...v1.3.1) - 2021-11-03
110
+
111
+
112
+ ### Fixed
113
+
114
+ - Fix REPL if bundler environment isn't set ([#2338](https://github.com/opal/opal/pull/2338))
115
+ - Fix Chrome runner if bundler environment isn't set and make it work on other Unixes ([#2339](https://github.com/opal/opal/pull/2339))
116
+ - `Proc#binding` to return a binding if `Binding` is defined (#2341, #2340)
117
+ - `Array#zip` to correctly `yield` (#2342, #1611)
118
+ - `String#scan` to correctly `yield` (#2342, #1660)
119
+
120
+
121
+
122
+
18
123
  ## [1.3.0](https://github.com/opal/opal/compare/v1.2.0...v1.3.0) - 2021-10-27
19
124
 
20
125
 
@@ -80,7 +185,7 @@ Changes are grouped as follows:
80
185
  ### Fixed
81
186
 
82
187
  - Fixed multiple line `Regexp` literal to not generate invalid syntax as JavaScript ([#1616](https://github.com/opal/opal/pull/1616))
83
- - Fix `Kernel#{try,catch}` along with `UncaughtThrowError` ([#2264](https://github.com/opal/opal/pull/2264))
188
+ - Fix `Kernel#{throw,catch}` along with `UncaughtThrowError` ([#2264](https://github.com/opal/opal/pull/2264))
84
189
  - Update source-map-support to fix an off-by-one error ([#2264](https://github.com/opal/opal/pull/2264))
85
190
  - Source map: lines should start from 1, not 0 ([#2273](https://github.com/opal/opal/pull/2273))
86
191
  - Allow for multiple underscored args with the same name in strict mode ([#2292](https://github.com/opal/opal/pull/2292))
@@ -109,10 +214,6 @@ Changes are grouped as follows:
109
214
  - `Process` is now a Module, not a Class - just like in MRI ([#2332](https://github.com/opal/opal/pull/2332))
110
215
  - `s = StringIO.new("a"); s << "b"; s.string` now returns "b", like MRI, but Opal used to return "ab" ([#2309](https://github.com/opal/opal/pull/2309))
111
216
 
112
- ### Deprecated
113
-
114
- ### Removed
115
-
116
217
  ### Internal
117
218
 
118
219
  - Switch from jshint to ESLint ([#2289](https://github.com/opal/opal/pull/2289))
data/UNRELEASED.md CHANGED
@@ -1,6 +1,8 @@
1
+ <!--
1
2
  ### Added
2
3
  ### Fixed
3
4
  ### Changed
4
- ### Deprecated
5
5
  ### Removed
6
+ ### Deprecated
6
7
  ### Internal
8
+ -->
@@ -0,0 +1,30 @@
1
+ Benchmark.ips do |x|
2
+ %x{
3
+ // Old version truthy logic
4
+ var old_version = function(x) { return x !== nil && x != null && (!x.$$is_boolean || x == true); }
5
+
6
+ // New version truthy logic
7
+ var new_version_1 = function(val) { return undefined !== val && null !== val && false !== val && nil !== val && (!(val instanceof Boolean) || true === val.valueOf()); }
8
+
9
+ // Alternative new version truthy logic
10
+ var new_version_2 = function(val) { return undefined !== val && null !== val && false !== val && nil !== val && !(val instanceof Boolean && false === val.valueOf()); }
11
+
12
+ // Alternative new version, nil&false first
13
+ var new_version_3 = function(val) { return false !== val && nil !== val && undefined !== val && null !== val && !(val instanceof Boolean && false === val.valueOf()); }
14
+
15
+ // Alternative new version truthy logic that unsupports boxed booleans
16
+ var new_unboxed = function(val) { return undefined !== val && null !== val && false !== val && nil !== val; }
17
+ }
18
+
19
+ values = [123,243,35,"sd",false,nil,123413234,120412,0,1234.1234,0.34,false,false,true,"sadfasf","","0",13,123,nil,Object.new,[]]
20
+
21
+ x.time = 32
22
+
23
+ x.report('old_version') { values.map(&`old_version`) }
24
+ x.report('new_version_1') { values.map(&`new_version_1`) }
25
+ x.report('new_version_2') { values.map(&`new_version_2`) }
26
+ x.report('new_version_3') { values.map(&`new_version_3`) }
27
+ x.report('new_unboxed') { values.map(&`new_unboxed`) }
28
+
29
+ x.compare!
30
+ end
data/bin/opal-mspec CHANGED
@@ -7,7 +7,5 @@ specs = ARGV.map do |s|
7
7
  end
8
8
 
9
9
  env = {}
10
- env['MSPEC_PATTERN'] = "{#{specs.join(',')}}" if specs.any?
10
+ env['PATTERN'] = "{#{specs.join(',')}}" if specs.any?
11
11
  exec env, 'rake', 'mspec'
12
-
13
- # RUBYOPT="-rbundler/setup -rmspec/opal/special_calls" bundle exec mspec run -t opal -pspec/ruby/spec_helper spec/ruby/core/true/*
data/bin/opal-repl CHANGED
@@ -1,4 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'bundler/setup'
4
- load "#{__dir__}/../exe/opal-repl"
3
+ exec "#{__dir__}/opal", '--repl', *ARGV
data/bin/remove-filters CHANGED
@@ -15,10 +15,7 @@
15
15
  # 5) "Set#filter! returns nil when self was not modified"
16
16
 
17
17
  filters = $stdin.read.split("\n").map do |i|
18
- # This special example should be rather moved to unsupported for now...
19
- next if i =~ /formats the local time following the pattern/
20
-
21
- i.scan(/\d+\) (".*")/).first.first
18
+ i.scan(/(?:\d+\)|fails) (".*")/).first.first
22
19
  end.compact
23
20
  filters = Regexp.union(*filters)
24
21
 
@@ -30,8 +30,8 @@ to convert values to opal specific values.
30
30
 
31
31
  NOTE: Because `true` and `false` compile to their native
32
32
  javascript equivalents, they must share the same class: `Boolean`.
33
- For this reason, they do not belong to their respective `TrueClass`
34
- and `FalseClass` classes from ruby.
33
+ Thru some level of hackery, we make them pseudo-members of the appropriate
34
+ `TrueClass` and `FalseClass`.
35
35
 
36
36
  #### Strings & Symbols
37
37
 
@@ -55,11 +55,11 @@ class. Symbols and Strings can therefore be used interchangeably.
55
55
 
56
56
  #### Numbers
57
57
 
58
- In Opal there is a single class for numbers; `Numeric`. To keep Opal
58
+ In Opal there is a single class for numbers; `Number`. To keep Opal
59
59
  as performant as possible, Ruby numbers are mapped to native numbers.
60
60
  This has the side effect that all numbers must be of the same class.
61
- Most relevant methods from `Integer`, `Float` and `Numeric` are
62
- implemented on this class.
61
+ Most relevant methods from `Integer` and `Float` are implemented on
62
+ this class.
63
63
 
64
64
  ```ruby
65
65
  42 # => 42
@@ -104,7 +104,7 @@ else is a truthy value including `""`, `0` and `[]`. This differs from
104
104
  JavaScript as these values are also treated as false.
105
105
 
106
106
  For this reason, most truthy tests must check if values are `false` or
107
- `nil`.
107
+ `nil` (we also check for `null` and `undefined`).
108
108
 
109
109
  Taking the following test:
110
110
 
@@ -178,15 +178,19 @@ puts "foo"
178
178
  This would compile directly into:
179
179
 
180
180
  ```javascript
181
- (function(Opal) {
182
- var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;
181
+ Opal.queue(function(Opal) {
182
+ var self = Opal.top, nil = Opal.nil;
183
183
 
184
- Opal.add_stubs(['$puts']);
184
+ Opal.add_stubs('puts');
185
185
  return self.$puts("foo")
186
- })(Opal);
186
+ });
187
187
  ```
188
188
 
189
- **TIP:** you can see the compiled code with this command: `opal --compile --no-exit --no-opal --eval 'puts "foo"'`
189
+ **TIP:**
190
+
191
+ you can see the compiled code with this command: `opal --compile --no-exit --no-opal --eval 'puts "foo"'`
192
+ or, more briefly: `opal -cEO -e 'puts "foo"'`
193
+
190
194
 
191
195
  ### Using compiled sources
192
196
 
@@ -204,16 +208,16 @@ obvious what went wrong.
204
208
 
205
209
  As Opal just generates JavaScript, it is useful to use a native
206
210
  debugger to work through JavaScript code. To use a debugger, simply
207
- add an x-string similar to the following at the place you wish to
208
- debug:
211
+ add a `debugger` statement:
209
212
 
210
213
  ```ruby
211
214
  # .. code
212
- `debugger`
215
+ debugger
213
216
  # .. more code
214
217
  ```
215
- The x-strings just pass the debugger statement straight through to the
216
- JavaScript output.
218
+
219
+ The `debugger` statement is compiled to become a JavaScript `debugger`
220
+ statement. This statement breaks the code if you have your Inspector open.
217
221
 
218
222
  NOTE: All local variables and method/block arguments also keep their Ruby
219
223
  names except in the rare cases when the name is reserved in JavaScript.
@@ -246,7 +250,7 @@ in the browser.
246
250
  }
247
251
 
248
252
  # => opal version is:
249
- # => 0.6.0
253
+ # => 1.3.1
250
254
  ```
251
255
 
252
256
  Even interpolations are supported, as seen here.
@@ -280,6 +284,9 @@ require 'native'
280
284
  win = Native(`window`) # equivalent to Native::Object.new(`window`)
281
285
  ```
282
286
 
287
+ To access a Native-wrapped global JavaScript object, we can also use `$$`, after
288
+ we have the `native` module required.
289
+
283
290
  Now what if we want to access one of its properties?
284
291
 
285
292
  ```ruby
@@ -514,10 +521,10 @@ Opal.BAZ; // => 789
514
521
  To reach nested constants the safest way is to call `#const_get` on `Object`:
515
522
 
516
523
  ```javascript
517
- Opal.Object.$$const_get('Bar::BAR'); // => 123
518
- Opal.Object.$$const_get('Foo::BAR'); // => 123
519
- Opal.Object.$$const_get('Foo::FOO'); // => 456
520
- Opal.Object.$$const_get('BAZ'); // => 789
524
+ Opal.Object.$const_get('Bar::BAR'); // => 123
525
+ Opal.Object.$const_get('Foo::BAR'); // => 123
526
+ Opal.Object.$const_get('Foo::FOO'); // => 456
527
+ Opal.Object.$const_get('BAZ'); // => 789
521
528
  ```
522
529
 
523
530
  Constants can also be navigated using the `$$` property, although this is limited to constants defined directly under the current object:
@@ -528,6 +535,14 @@ Opal.Foo.$$.FOO // => 456
528
535
  Opal.Foo.$$.BAR // => undefined
529
536
  ```
530
537
 
538
+ A later feature also allows you to skip the `$$` property:
539
+
540
+ ```javascript
541
+ Opal.Bar.BAR // => 123
542
+ Opal.Foo.FOO // => 456
543
+ Opal.Foo.BAR // => undefined
544
+ ```
545
+
531
546
 
532
547
  ### Calling methods
533
548
 
@@ -656,7 +671,7 @@ It is obvious from here, that unless an object defines any given method, it will
656
671
  To optimise the generated code slightly, we reduce the code output from the compiler into the following JavaScript:
657
672
 
658
673
  ```javascript
659
- Opal.add_stubs(["first", "second", "to_sym"]);
674
+ Opal.add_stubs("first,second,to_sym"]);
660
675
  ```
661
676
 
662
677
  You will see this at the top of all your generated JavaScript files. This will add a stub method for all methods used in your file.
data/docs/faq.md CHANGED
@@ -10,7 +10,7 @@ We run opal against the [ruby spec](https://github.com/ruby/spec) as our primary
10
10
 
11
11
  ### What version of ruby does Opal target?
12
12
 
13
- We are running tests under ruby 2.0.0 conditions, but are mostly compatible with 1.9 level features.
13
+ We are running tests under ruby 3.0.0 conditions, but are mostly compatible with 2.6 level features.
14
14
 
15
15
  ### Why doesn't Opal support mutable strings?
16
16
 
@@ -3,7 +3,6 @@
3
3
  ## Requirements
4
4
 
5
5
  First of all, make sure that you have Chrome at least 59.0 installed.
6
- Also for now it's supported only on Mac and Linux. (version 60 may get support on Windows)
7
6
 
8
7
  ## Using the runner
9
8
 
@@ -22,11 +21,9 @@ The runner also listens for any exceptions and prints formatted stracktraces bac
22
21
  raising_method
23
22
  "
24
23
 
25
- RuntimeError : test error
26
- at $$raise (file:///tmp/chrome-opal.js:4996:6)
27
- at $$raising_method (file:///tmp/chrome-opal.js:21144:16)
28
- at (file:///tmp/chrome-opal.js:21146:14)
29
- at (file:///tmp/chrome-opal.js:21147:2)
24
+ RuntimeError: test error
25
+ from <internal:corelib/…>:2693:7:in `<main>'
26
+ from -e:1:1:in `undefined'
30
27
 
31
28
  ## Using exit codes
32
29
 
@@ -36,10 +33,9 @@ By default headless chrome runner explicitly sets exit code to 1 when there was
36
33
  0
37
34
 
38
35
  $ opal -Rchrome -e "raise 'error'"; echo $?
39
- RuntimeError : error
40
- at $$raise (file:///tmp/chrome-opal.js:4996:6)
41
- at (file:///tmp/chrome-opal.js:21139:14)
42
- at (file:///tmp/chrome-opal.js:21140:2)
36
+ RuntimeError: error
37
+ from <internal:corelib/kerne…>:2693:7:in `<main>'
38
+ from -e:1:1:in `undefined'
43
39
  1
44
40
 
45
41
  You can change final exit code by using `Kernel#exit`, but make sure to require `opal/platform` in your code.
@@ -69,20 +65,12 @@ or runs the server on its own. It detects your platform and uses a default path
69
65
  (`Opal::CliRunners::Chrome#chrome_executable`) but you can override it by specifying `GOOGLE_CHROME_BINARY` environment
70
66
  variable.
71
67
 
72
- When the server is up and running it passes compiled js code to `node lib/opal/cli_runners/chrome.js`
68
+ When the server is up and running it passes compiled js code to `lib/opal/cli_runners/chrome_cdp_interface.rb`
73
69
  as a plain input using stdin (basically, it's a second part of the runner).
74
- `chrome.js` is a node js script that does the main job. It runs any provided code on the running chrome server,
70
+ `chrome_cdp_interface.rb` is a node js + Opal script that does the main job. It runs any provided code on the running chrome server,
75
71
  catches errors and forwards console messages.
76
72
 
77
73
 
78
- Moreover, you can actually call any js using headless chrome by running
79
-
80
- $ echo "console.log('Hello, Opal')" | node lib/opal/cli_runners/chrome.js
81
-
82
- NOTE: to run it you need to have a chrome server running on `localhost:9222` (usually `chrome.rb` does it for you)
83
-
84
- $ chrome --disable-gpu --headless --remote-debugging-port=9222
85
-
86
74
  ## Using a remote chrome server
87
75
 
88
76
  If you want to change a default chrome port or your chrome server is running on a different host:port
@@ -99,7 +87,9 @@ NOTE: `CHROME_HOST` requires a chrome server to be started. You can't start remo
99
87
 
100
88
  If you need to pass additional CLI options to the Chrome executable you can do so by setting the `CHROME_OPTS` environment variable:
101
89
 
102
- $ CHROME_OPS="--window-size=412,732" opal -Rchrome -e "puts 42"
90
+ $ CHROME_OPTS="--window-size=412,732" opal -Rchrome -e "puts 42"
103
91
  42
104
92
 
93
+ Docker users may need `CHROME_OPTS="--no-sandbox"` due to the user namespaces limitations.
94
+
105
95
  _For a list of additional options see https://developers.google.com/web/updates/2017/04/headless-chrome_
data/docs/jquery.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # JQuery
2
2
 
3
- `opal-jquery` offers a nicer ruby-like syntax for JQuery (and Zepto). It is
4
- useful for projects which cannot use `opal-browser` due to a reliance on jquery
5
- for plugins or other libraries.
3
+ `opal-jquery` offers a nicer ruby-like syntax for JQuery. It is useful for projects which cannot use `opal-browser` due to a reliance on jquery for plugins or other libraries.
6
4
 
7
5
  ```ruby
8
6
  foos = Element.find('.foo')
@@ -91,9 +89,6 @@ bridged instances of jquery objects. Just like ruby arrays are just javascript
91
89
  arrays, `Element` instances are just jquery objects. This makes interaction
92
90
  with jquery plugins much easier.
93
91
 
94
- Also, `Element` will try to bridge with Zepto if it cannot find jQuery loaded,
95
- making it ideal for mobile applications as well.
96
-
97
92
  ### Interacting with the DOM
98
93
 
99
94
  #### Finding Elements
data/docs/opal_parser.md CHANGED
@@ -8,12 +8,14 @@ Opal is able to compile its – pure Ruby – compiler to JavaScript (how cool i
8
8
  require 'opal-parser'
9
9
  ```
10
10
 
11
+ _Note: For the best performance and application load times, it is strongly recommended to design your application so that it won't need the parser. A lot of methods described in this document are more fun hacks than robust solutions. But if you really want or need to use them, for example so that you can implement a Ruby REPL or an interactive Ruby playground - we have you covered, but for all other cases, we strongly discourage you to take an advice from this guide._
12
+
11
13
 
12
14
  ## Features
13
15
 
14
16
  ### `Kernel#eval`
15
17
 
16
- `opal-parser` provides a partial implementation of `Kernel#eval` that only support the first parameter (String) and refuse any passed `binding`, `lineno` or `filename`.
18
+ `opal-parser` provides a partial implementation of `Kernel#eval`.
17
19
 
18
20
  Example:
19
21
 
data/docs/promises.md CHANGED
@@ -8,6 +8,8 @@ It can be required inside any Opal applicaton:
8
8
  require 'promise'
9
9
  ```
10
10
 
11
+ _Please also take a look at the Asynchronous code guide - we are in the process of modernizing the Promises, along with supporting async/await_
12
+
11
13
  ## Usage
12
14
 
13
15
  This example shows how to use a `HTTP` request from `opal-jquery` from a callback style, into a promise style handler.
data/docs/releasing.md CHANGED
@@ -11,8 +11,26 @@ _This guide is a work-in-progress._
11
11
 
12
12
  - Ensure all the unreleased changes are documented in UNRELEASED.md
13
13
  - Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
14
+ - Empty UNRELEASED.md
14
15
 
15
16
  ## The commit
16
17
 
17
- - Commit the updated changelog along with the version bump using this commmit message:
18
+ - Commit the updated changelog along with the version bump using this commit message:
18
19
  "Release v1.2.3"
20
+ - Push the commit and run `bin/rake release` to release the new version to Rubygems
21
+ - Go to GitHub releases and create a new release from the latest tag pasting the contents from CHANGELOG.md
22
+
23
+ ## Opal docs
24
+
25
+ - Open `opal-docs` and run `bin/build v1.2.3`
26
+ - Then run `bin/deploy`
27
+
28
+ ## Opal site
29
+
30
+ - Open `opal.github.io` and update the opal version in the `Gemfile`
31
+ - run `bin/build`
32
+ - `git push` the latest changes
33
+
34
+ ## Opal CDN
35
+
36
+ - Run `bin/release v1.2.3`
@@ -23,7 +23,6 @@ class App < Roda
23
23
  plugin :sprockets, precompile: %w(application.js),
24
24
  prefix: %w(app/),
25
25
  opal: true,
26
- debug: ENV['RACK_ENV'] != 'production'
27
26
  plugin :public
28
27
 
29
28
  route do |r|
data/docs/source_maps.md CHANGED
@@ -1,10 +1,6 @@
1
1
  # Source maps
2
2
 
3
- Source maps are available (on current stable release, v0.6.x) even without explicit support from Sprockets in a sort of hackish way.
4
-
5
- _As such even if they generally work fine there are some limitations and edge case issues._
6
-
7
- NOTE: Currently on `master` branch sourcemaps are work-in-progress and probably will integrate with the upcoming Sprockets 4 that has integrated support for them.
3
+ Source maps are available on most environments we support.
8
4
 
9
5
  #### Processor `source_map_enabled` flag
10
6
  To enable sourcemaps in the Sprockets processor you need to turn on the relative flag:
@@ -16,8 +12,7 @@ Opal::Config.source_map_enabled = true # default
16
12
 
17
13
  #### Sprockets debug mode
18
14
 
19
- The sourcemaps only work with Sprockets in debug mode because they are generated just for single files.
20
-
15
+ The source maps only work with Sprockets in debug mode - this is a limitation of Sprockets.
21
16
 
22
17
  ## Enable source maps
23
18
 
@@ -37,13 +32,17 @@ config.assets.debug = true
37
32
 
38
33
  ### Sinatra
39
34
 
40
- You can add `Opal::Server` as in the official example: [sinatra/config.ru](https://github.com/opal/opal/blob/0-6-stable/examples/sinatra/config.ru).
35
+ You can add `Opal::Server` as in the official example: [sinatra/config.ru](https://github.com/opal/opal/blob/master/examples/sinatra/config.ru).
41
36
 
42
37
  ### Opal::Server
43
38
 
44
- `Opal::Server` implements sourcemaps and can be used alone or with `Rack::Cascade` in conjunction with other apps.
39
+ `Opal::Server` (which is based on Sprockets) implements sourcemaps and can be used alone or with `Rack::Cascade` in conjunction with other apps.
40
+
41
+ ### Opal::SimpleServer
42
+
43
+ Like `Opal::Server`, `Opal::SimpleServer` (which isn't based on Sprockets) implements sourcemaps properly.
45
44
 
46
- ### Opal::Environment
45
+ ### Opal::Builder
47
46
 
48
- `Opal::Environment` is a bit lower level and doesn't support source maps by itself.
47
+ `Opal::Builder` is a bit lower level and doesn't support source maps by itself. It requires you to call in a specific method to generate them yourself.
49
48
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  `opal` makes it easy to build static opal applications. Opal uses internal load
4
4
  paths to make it easy to handle resolving requirements during building. `opal`
5
- forms the basis of rails support, so anything you can do there, you can do
5
+ forms the basis of Rails support, so anything you can do there, you can do
6
6
  standalone as well.
7
7
 
8
8
  ## Overview
@@ -11,7 +11,7 @@ First, install `opal` adding them to a `Gemfile`:
11
11
 
12
12
  ```ruby
13
13
  # Gemfile
14
- gem "opal", "~> 0.7.0"
14
+ gem "opal"
15
15
  ```
16
16
 
17
17
  Next, we want to add our main app code. Keep all opal code inside `app/`
@@ -6,6 +6,10 @@ Opal does not support some language/runtime features of ruby. These are document
6
6
 
7
7
  For performance and ease of runtime features, all strings in Opal are immutable, i.e. `#<<`, `#gsub!`, etc. do not exist. Also, symbols are just strings. There is no class, runtime or feature difference between Symbols and Strings. Their syntaxes can be used interchangeably.
8
8
 
9
+ #### Regexp differences ####
10
+
11
+ We are using JavaScript regular expressions. While we do translate a few of Ruby specific instructions like `\A` or `\z`, there are a lot of incompatibilities that you should be aware of - for example `$` and `^` don't match newlines like they do in Ruby. Support for features like named matches or lookahead/lookbehind is dependent on the JavaScript environment support for those. To support everything, we would need to [compile in the entire Ruby's regular expression engine](https://opalrb.com/blog/2021/06/26/webassembly-and-advanced-regexp-with-opal/) which is unfeasible at the current time.
12
+
9
13
  #### Integer / Float difference ####
10
14
 
11
15
  In Opal, both integers and floats belong to same class `Number` (using JavaScript native numbers). So `1 / 4` is `0.25` (not `0`) and `4.0 / 2` is `2` (not `2.0`).
data/exe/opal-repl CHANGED
@@ -1,5 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- ARGV << "--repl"
4
-
5
- load __dir__+"/opal"
3
+ exec "#{__dir__}/opal", '--repl', *ARGV
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'opal/ast/node'
4
- require 'parser/ruby30'
4
+ require 'parser/ruby31'
5
5
 
6
6
  module Opal
7
7
  module AST