opal 0.7.0.beta1 → 0.7.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.gitmodules +1 -1
  4. data/.inch.yml +19 -0
  5. data/.travis.yml +10 -7
  6. data/CHANGELOG.md +23 -0
  7. data/README.md +2 -2
  8. data/Rakefile +43 -1
  9. data/bin/opal +6 -1
  10. data/lib/mspec/opal/rake_task.rb +10 -31
  11. data/lib/mspec/opal/runner.rb +44 -1
  12. data/lib/mspec/opal/special_calls.rb +25 -0
  13. data/lib/opal/builder.rb +1 -1
  14. data/lib/opal/builder_processors.rb +4 -23
  15. data/lib/opal/cli.rb +17 -11
  16. data/lib/opal/cli_options.rb +1 -1
  17. data/lib/opal/cli_runners.rb +1 -0
  18. data/lib/opal/cli_runners/apple_script.rb +65 -0
  19. data/lib/opal/cli_runners/nodejs.rb +9 -3
  20. data/lib/opal/cli_runners/phantomjs.rb +2 -2
  21. data/lib/opal/cli_runners/server.rb +7 -5
  22. data/lib/opal/compiler.rb +1 -1
  23. data/lib/opal/nodes/call.rb +3 -2
  24. data/lib/opal/nodes/constants.rb +3 -3
  25. data/lib/opal/nodes/def.rb +7 -7
  26. data/lib/opal/nodes/defined.rb +2 -2
  27. data/lib/opal/nodes/definitions.rb +1 -1
  28. data/lib/opal/nodes/literal.rb +1 -1
  29. data/lib/opal/nodes/logic.rb +1 -1
  30. data/lib/opal/nodes/masgn.rb +1 -1
  31. data/lib/opal/nodes/module.rb +1 -1
  32. data/lib/opal/nodes/rescue.rb +1 -1
  33. data/lib/opal/nodes/scope.rb +1 -1
  34. data/lib/opal/nodes/super.rb +3 -3
  35. data/lib/opal/nodes/top.rb +11 -9
  36. data/lib/opal/nodes/variables.rb +39 -6
  37. data/lib/opal/nodes/yield.rb +3 -3
  38. data/lib/opal/parser.rb +3 -1
  39. data/lib/opal/parser/lexer.rb +8 -2
  40. data/lib/opal/paths.rb +13 -3
  41. data/lib/opal/sprockets/server.rb +1 -1
  42. data/lib/opal/version.rb +1 -1
  43. data/opal.gemspec +1 -1
  44. data/opal/corelib/array.rb +29 -20
  45. data/opal/corelib/array/inheritance.rb +3 -3
  46. data/opal/corelib/basic_object.rb +3 -1
  47. data/opal/corelib/class.rb +1 -1
  48. data/opal/corelib/comparable.rb +6 -5
  49. data/opal/corelib/dir.rb +4 -4
  50. data/opal/corelib/enumerable.rb +25 -25
  51. data/opal/corelib/enumerator.rb +16 -14
  52. data/opal/corelib/error.rb +13 -4
  53. data/opal/corelib/hash.rb +511 -162
  54. data/opal/corelib/helpers.rb +1 -1
  55. data/opal/corelib/kernel.rb +60 -44
  56. data/opal/corelib/match_data.rb +1 -10
  57. data/opal/corelib/method.rb +1 -1
  58. data/opal/corelib/module.rb +62 -32
  59. data/opal/corelib/nil_class.rb +1 -6
  60. data/opal/corelib/numeric.rb +6 -3
  61. data/opal/corelib/proc.rb +1 -1
  62. data/opal/corelib/regexp.rb +15 -6
  63. data/opal/corelib/runtime.js +57 -36
  64. data/opal/corelib/string.rb +38 -2
  65. data/opal/corelib/string/inheritance.rb +3 -3
  66. data/opal/corelib/struct.rb +1 -1
  67. data/opal/corelib/time.rb +46 -3
  68. data/spec/filters/bugs/date.rb +15 -0
  69. data/spec/filters/bugs/enumerator.rb +7 -0
  70. data/spec/filters/bugs/exception.rb +12 -0
  71. data/spec/filters/bugs/hash.rb +0 -18
  72. data/spec/filters/bugs/match_data.rb +13 -0
  73. data/spec/filters/bugs/module.rb +13 -0
  74. data/spec/filters/bugs/numeric.rb +2 -0
  75. data/spec/filters/bugs/regexp.rb +0 -2
  76. data/spec/filters/bugs/stringscanner.rb +8 -0
  77. data/spec/filters/bugs/time.rb +1 -1
  78. data/spec/filters/unsupported/float.rb +1 -0
  79. data/spec/filters/unsupported/symbols.rb +10 -0
  80. data/spec/filters/unsupported/tainted.rb +3 -0
  81. data/spec/filters/unsupported/trusted.rb +3 -0
  82. data/spec/lib/compiler_spec.rb +2 -2
  83. data/spec/lib/parser/call_spec.rb +7 -0
  84. data/spec/opal/core/date_spec.rb +49 -8
  85. data/spec/opal/core/exception_spec.rb +13 -0
  86. data/spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb +1 -0
  87. data/spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb +1 -0
  88. data/spec/opal/core/fixtures/require_tree_files/other/other 1.rb +1 -0
  89. data/spec/opal/core/kernel/require_tree_spec.rb +3 -1
  90. data/spec/opal/core/language/predefined_spec.rb +43 -0
  91. data/spec/opal/stdlib/promise/rescue_spec.rb +9 -0
  92. data/spec/opal/stdlib/promise/then_spec.rb +9 -0
  93. data/spec/opal/stdlib/promise/trace_spec.rb +9 -0
  94. data/spec/rubyspecs +40 -19
  95. data/spec/spec_helper.rb +10 -5
  96. data/stdlib/date.rb +68 -8
  97. data/stdlib/fileutils.rb +0 -0
  98. data/stdlib/iconv.rb +0 -0
  99. data/stdlib/json.rb +16 -3
  100. data/stdlib/native.rb +36 -17
  101. data/stdlib/nodejs.rb +3 -0
  102. data/stdlib/nodejs/dir.rb +1 -1
  103. data/stdlib/nodejs/file.rb +2 -2
  104. data/stdlib/nodejs/io.rb +1 -1
  105. data/stdlib/nodejs/process.rb +2 -2
  106. data/stdlib/nodejs/require.rb +5 -7
  107. data/stdlib/nodejs/runtime.rb +3 -2
  108. data/stdlib/pathname.rb +25 -1
  109. data/stdlib/promise.rb +16 -0
  110. data/stdlib/set.rb +48 -4
  111. data/stdlib/strscan.rb +12 -1
  112. data/stdlib/yaml.rb +1 -0
  113. metadata +27 -7
  114. data/spec/opal/core/language/symbol_spec.rb +0 -40
@@ -11,14 +11,14 @@ module Opal
11
11
 
12
12
  if yields_single_arg?(children)
13
13
  push expr(children.first)
14
- wrap "$opal.$yield1(#{block_name}, ", ')'
14
+ wrap "Opal.yield1(#{block_name}, ", ')'
15
15
  else
16
16
  push expr(s(:arglist, *children))
17
17
 
18
18
  if uses_splat?(children)
19
- wrap "$opal.$yieldX(#{block_name}, ", ')'
19
+ wrap "Opal.yieldX(#{block_name}, ", ')'
20
20
  else
21
- wrap "$opal.$yieldX(#{block_name}, [", '])'
21
+ wrap "Opal.yieldX(#{block_name}, [", '])'
22
22
  end
23
23
  end
24
24
  end
@@ -589,13 +589,15 @@ module Opal
589
589
  end
590
590
 
591
591
  def new_dsym(str)
592
- return s(:nil) unless str
592
+ return s(:sym, :"") unless str
593
593
  case str.type
594
594
  when :str
595
595
  str.type = :sym
596
596
  str[1] = str[1].to_sym
597
597
  when :dstr
598
598
  str.type = :dsym
599
+ when :evstr
600
+ str = s(:dsym, str)
599
601
  end
600
602
 
601
603
  str
@@ -100,6 +100,10 @@ module Opal
100
100
  [:expr_fname, :expr_dot].include? @lex_state
101
101
  end
102
102
 
103
+ def label_state?
104
+ [:expr_beg, :expr_endfn].include?(@lex_state) or arg?
105
+ end
106
+
103
107
  def spcarg?
104
108
  arg? and @space_seen and !space?
105
109
  end
@@ -501,7 +505,7 @@ module Opal
501
505
  def process_identifier(matched, cmd_start)
502
506
  last_state = @lex_state
503
507
 
504
- if !check(/::/) and scan(/:/)
508
+ if label_state? and !check(/::/) and scan(/:/)
505
509
  @lex_state = :expr_beg
506
510
  self.yylval = matched
507
511
  return :tLABEL
@@ -800,7 +804,7 @@ module Opal
800
804
  self.set_arg_state
801
805
  return :tPIPE
802
806
 
803
- elsif scan(/\%[QqWwixr]/)
807
+ elsif scan(/\%[QqWwixrs]/)
804
808
  str_type = scanner.matched[1, 1]
805
809
  paren = term = scan(/./)
806
810
 
@@ -827,6 +831,8 @@ module Opal
827
831
  [:tXSTRING_BEG, STR_XQUOTE]
828
832
  when 'r'
829
833
  [:tREGEXP_BEG, STR_REGEXP]
834
+ when 's'
835
+ [:tSTRING_BEG, STR_SQUOTE]
830
836
  end
831
837
 
832
838
  self.strterm = new_strterm2(func, term, paren)
@@ -20,15 +20,25 @@ module Opal
20
20
  end
21
21
 
22
22
  def self.use_gem(gem_name, include_dependecies = true)
23
+ require_paths_for_gem(gem_name, include_dependecies).each do |path|
24
+ append_path path
25
+ end
26
+ end
27
+
28
+ def self.require_paths_for_gem(gem_name, include_dependecies)
29
+ paths = []
23
30
  spec = Gem::Specification.find_by_name(gem_name)
24
31
 
25
32
  spec.runtime_dependencies.each do |dependency|
26
- use_gem dependency.name
33
+ paths += require_paths_for_gem(dependency.name, include_dependecies)
27
34
  end if include_dependecies
28
35
 
29
- spec.require_paths.each do |path|
30
- Opal.append_path File.join(spec.gem_dir, path)
36
+ gem_dir = spec.gem_dir
37
+ spec.require_paths.map do |path|
38
+ paths << File.join(gem_dir, path)
31
39
  end
40
+
41
+ paths
32
42
  end
33
43
 
34
44
  # Private, don't add to these directly (use .append_path instead).
@@ -73,7 +73,7 @@ module Opal
73
73
  @use_index = true
74
74
  @public_root = nil
75
75
  @public_urls = ['/']
76
- @sprockets = Environment.new
76
+ @sprockets = options.fetch(:sprockets, Environment.new)
77
77
  @debug = options.fetch(:debug, true)
78
78
  @prefix = options.fetch(:prefix, '/assets')
79
79
 
@@ -1,3 +1,3 @@
1
1
  module Opal
2
- VERSION = '0.7.0.beta1'
2
+ VERSION = '0.7.0.beta2'
3
3
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  required_ruby_version = '>= 1.9.3'
22
22
 
23
23
  s.add_dependency 'sourcemap', '~> 0.1.0'
24
- s.add_dependency 'sprockets', '>= 2.2.1', '< 4.0.0'
24
+ s.add_dependency 'sprockets', '>= 2.2.3', '< 4.0.0'
25
25
  s.add_dependency 'hike', '~> 1.2'
26
26
  s.add_dependency 'tilt', '~> 1.4'
27
27
 
@@ -462,7 +462,7 @@ class Array
462
462
  %x{
463
463
  while (true) {
464
464
  for (var i = 0, length = self.length; i < length; i++) {
465
- var value = $opal.$yield1(block, self[i]);
465
+ var value = Opal.yield1(block, self[i]);
466
466
 
467
467
  if (value === $breaker) {
468
468
  return $breaker.$v;
@@ -480,7 +480,7 @@ class Array
480
480
 
481
481
  while (n > 0) {
482
482
  for (var i = 0, length = self.length; i < length; i++) {
483
- var value = $opal.$yield1(block, self[i]);
483
+ var value = Opal.yield1(block, self[i]);
484
484
 
485
485
  if (value === $breaker) {
486
486
  return $breaker.$v;
@@ -524,7 +524,7 @@ class Array
524
524
  var result = [];
525
525
 
526
526
  for (var i = 0, length = self.length; i < length; i++) {
527
- var value = Opal.$yield1(block, self[i]);
527
+ var value = Opal.yield1(block, self[i]);
528
528
 
529
529
  if (value === $breaker) {
530
530
  return $breaker.$v;
@@ -542,7 +542,7 @@ class Array
542
542
 
543
543
  %x{
544
544
  for (var i = 0, length = self.length; i < length; i++) {
545
- var value = Opal.$yield1(block, self[i]);
545
+ var value = Opal.yield1(block, self[i]);
546
546
 
547
547
  if (value === $breaker) {
548
548
  return $breaker.$v;
@@ -677,7 +677,7 @@ class Array
677
677
 
678
678
  %x{
679
679
  for (var i = 0, length = self.length; i < length; i++) {
680
- var value = $opal.$yield1(block, self[i]);
680
+ var value = Opal.yield1(block, self[i]);
681
681
 
682
682
  if (value == $breaker) {
683
683
  return $breaker.$v;
@@ -693,7 +693,7 @@ class Array
693
693
 
694
694
  %x{
695
695
  for (var i = 0, length = self.length; i < length; i++) {
696
- var value = $opal.$yield1(block, i);
696
+ var value = Opal.yield1(block, i);
697
697
 
698
698
  if (value === $breaker) {
699
699
  return $breaker.$v;
@@ -916,7 +916,16 @@ class Array
916
916
  end
917
917
 
918
918
  def hash
919
- `self.$$id || (self.$$id = Opal.uid())`
919
+ %x{
920
+ var hash = ['A'], item, item_hash;
921
+ for (var i = 0, length = self.length; i < length; i++) {
922
+ item = self[i];
923
+ // Guard against recursion
924
+ item_hash = self === item ? 'self' : item.$hash();
925
+ hash.push(item_hash);
926
+ }
927
+ return hash.join(',');
928
+ }
920
929
  end
921
930
 
922
931
  def include?(member)
@@ -986,21 +995,21 @@ class Array
986
995
 
987
996
  def inspect
988
997
  %x{
989
- var i, inspect, el, el_insp, length, object_id;
990
-
991
- inspect = [];
992
- object_id = #{object_id};
993
- length = self.length;
994
-
995
- for (i = 0; i < length; i++) {
996
- el = #{self[`i`]};
998
+ var result = [],
999
+ id = #{__id__};
997
1000
 
998
- // Check object_id to ensure it's not the same array get into an infinite loop
999
- el_insp = #{`el`.object_id} === object_id ? '[...]' : #{`el`.inspect};
1001
+ for (var i = 0, length = self.length; i < length; i++) {
1002
+ var item = #{self[`i`]};
1000
1003
 
1001
- inspect.push(el_insp);
1004
+ if (#{`item`.__id__} === id) {
1005
+ result.push('[...]');
1006
+ }
1007
+ else {
1008
+ result.push(#{`item`.inspect});
1009
+ }
1002
1010
  }
1003
- return '[' + inspect.join(', ') + ']';
1011
+
1012
+ return '[' + result.join(', ') + ']';
1004
1013
  }
1005
1014
  end
1006
1015
 
@@ -1265,7 +1274,7 @@ class Array
1265
1274
  for (var i = 0, length = self.length, item, value; i < length; i++) {
1266
1275
  item = self[i];
1267
1276
 
1268
- if ((value = $opal.$yield1(block, item)) === $breaker) {
1277
+ if ((value = Opal.yield1(block, item)) === $breaker) {
1269
1278
  return $breaker.$v;
1270
1279
  }
1271
1280
 
@@ -3,10 +3,10 @@ class Array
3
3
  replace = Class.new(Array::Wrapper)
4
4
 
5
5
  %x{
6
- klass.$$proto = replace.$$proto;
6
+ klass.$$proto = replace.$$proto;
7
7
  klass.$$proto.$$class = klass;
8
- klass.$$alloc = replace.$$alloc;
9
- klass.$$parent = #{Array::Wrapper};
8
+ klass.$$alloc = replace.$$alloc;
9
+ klass.$$parent = #{Array::Wrapper};
10
10
 
11
11
  klass.$allocate = replace.$allocate;
12
12
  klass.$new = replace.$new;
@@ -68,6 +68,8 @@ class BasicObject
68
68
  end
69
69
 
70
70
  def method_missing(symbol, *args, &block)
71
- Kernel.raise NoMethodError, "undefined method `#{symbol}' for BasicObject instance"
71
+ Kernel.raise NoMethodError, `self.$inspect && !self.$inspect.$$stub` ?
72
+ "undefined method `#{symbol}' for #{inspect}:#{`self.$$class`}" :
73
+ "undefined method `#{symbol}' for #{`self.$$class`}"
72
74
  end
73
75
  end
@@ -13,7 +13,7 @@ class Class
13
13
  klass.$$parent = sup;
14
14
 
15
15
  // inherit scope from parent
16
- $opal.create_scope(sup.$$scope, klass);
16
+ Opal.create_scope(sup.$$scope, klass);
17
17
 
18
18
  sup.$inherited(klass);
19
19
 
@@ -11,7 +11,8 @@ module Comparable
11
11
  return true if equal?(other)
12
12
 
13
13
  return false unless cmp = (self <=> other)
14
- return Comparable.normalize(cmp) == 0
14
+
15
+ return `#{Comparable.normalize(cmp)} == 0`
15
16
  rescue StandardError
16
17
  false
17
18
  end
@@ -21,7 +22,7 @@ module Comparable
21
22
  raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
22
23
  end
23
24
 
24
- Comparable.normalize(cmp) > 0
25
+ `#{Comparable.normalize(cmp)} > 0`
25
26
  end
26
27
 
27
28
  def >=(other)
@@ -29,7 +30,7 @@ module Comparable
29
30
  raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
30
31
  end
31
32
 
32
- Comparable.normalize(cmp) >= 0
33
+ `#{Comparable.normalize(cmp)} >= 0`
33
34
  end
34
35
 
35
36
  def <(other)
@@ -37,7 +38,7 @@ module Comparable
37
38
  raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
38
39
  end
39
40
 
40
- Comparable.normalize(cmp) < 0
41
+ `#{Comparable.normalize(cmp)} < 0`
41
42
  end
42
43
 
43
44
  def <=(other)
@@ -45,7 +46,7 @@ module Comparable
45
46
  raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
46
47
  end
47
48
 
48
- Comparable.normalize(cmp) <= 0
49
+ `#{Comparable.normalize(cmp)} <= 0`
49
50
  end
50
51
 
51
52
  def between?(min, max)
@@ -1,15 +1,15 @@
1
1
  class Dir
2
2
  class << self
3
3
  def chdir(dir)
4
- prev_cwd = `$opal.current_dir`
5
- `$opal.current_dir = #{dir}`
4
+ prev_cwd = `Opal.current_dir`
5
+ `Opal.current_dir = #{dir}`
6
6
  yield
7
7
  ensure
8
- `$opal.current_dir = #{prev_cwd}`
8
+ `Opal.current_dir = #{prev_cwd}`
9
9
  end
10
10
 
11
11
  def pwd
12
- `$opal.current_dir` || '.'
12
+ `Opal.current_dir` || '.'
13
13
  end
14
14
  alias getwd pwd
15
15
 
@@ -5,7 +5,7 @@ module Enumerable
5
5
 
6
6
  if (block !== nil) {
7
7
  self.$each.$$p = function() {
8
- var value = $opal.$yieldX(block, arguments);
8
+ var value = Opal.yieldX(block, arguments);
9
9
 
10
10
  if (value === $breaker) {
11
11
  result = $breaker.$v;
@@ -39,7 +39,7 @@ module Enumerable
39
39
 
40
40
  if (block !== nil) {
41
41
  self.$each.$$p = function() {
42
- var value = $opal.$yieldX(block, arguments);
42
+ var value = Opal.yieldX(block, arguments);
43
43
 
44
44
  if (value === $breaker) {
45
45
  result = $breaker.$v;
@@ -78,7 +78,7 @@ module Enumerable
78
78
  var result = [];
79
79
 
80
80
  self.$each.$$p = function() {
81
- var value = $opal.$yieldX(block, arguments);
81
+ var value = Opal.yieldX(block, arguments);
82
82
 
83
83
  if (value === $breaker) {
84
84
  result = $breaker.$v;
@@ -113,7 +113,7 @@ module Enumerable
113
113
  }
114
114
 
115
115
  self.$each.$$p = function() {
116
- var value = $opal.$yieldX(block, arguments);
116
+ var value = Opal.yieldX(block, arguments);
117
117
 
118
118
  if (value === $breaker) {
119
119
  result = $breaker.$v;
@@ -146,7 +146,7 @@ module Enumerable
146
146
 
147
147
  self.$each.$$p = function() {
148
148
  var param = #{Opal.destructure(`arguments`)},
149
- value = $opal.$yield1(block, param);
149
+ value = Opal.yield1(block, param);
150
150
 
151
151
  if (value === $breaker) {
152
152
  result = $breaker.$v;
@@ -171,7 +171,7 @@ module Enumerable
171
171
  %x{
172
172
  while (true) {
173
173
  for (var i = 0, length = all.length; i < length; i++) {
174
- var value = $opal.$yield1(block, all[i]);
174
+ var value = Opal.yield1(block, all[i]);
175
175
 
176
176
  if (value === $breaker) {
177
177
  return $breaker.$v;
@@ -183,7 +183,7 @@ module Enumerable
183
183
  %x{
184
184
  while (n > 1) {
185
185
  for (var i = 0, length = all.length; i < length; i++) {
186
- var value = $opal.$yield1(block, all[i]);
186
+ var value = Opal.yield1(block, all[i]);
187
187
 
188
188
  if (value === $breaker) {
189
189
  return $breaker.$v;
@@ -204,7 +204,7 @@ module Enumerable
204
204
 
205
205
  self.$each.$$p = function() {
206
206
  var params = #{Opal.destructure(`arguments`)},
207
- value = $opal.$yield1(block, params);
207
+ value = Opal.yield1(block, params);
208
208
 
209
209
  if (value === $breaker) {
210
210
  result = $breaker.$v;
@@ -268,7 +268,7 @@ module Enumerable
268
268
  var param = #{Opal.destructure(`arguments`)};
269
269
 
270
270
  if (dropping) {
271
- var value = $opal.$yield1(block, param);
271
+ var value = Opal.yield1(block, param);
272
272
 
273
273
  if (value === $breaker) {
274
274
  result = $breaker.$v;
@@ -318,7 +318,7 @@ module Enumerable
318
318
  slice.push(param);
319
319
 
320
320
  if (slice.length === n) {
321
- if ($opal.$yield1(block, slice) === $breaker) {
321
+ if (Opal.yield1(block, slice) === $breaker) {
322
322
  result = $breaker.$v;
323
323
  return $breaker;
324
324
  }
@@ -335,7 +335,7 @@ module Enumerable
335
335
 
336
336
  // our "last" group, if smaller than n then won't have been yielded
337
337
  if (slice.length > 0) {
338
- if ($opal.$yield1(block, slice) === $breaker) {
338
+ if (Opal.yield1(block, slice) === $breaker) {
339
339
  return $breaker.$v;
340
340
  }
341
341
  }
@@ -423,7 +423,7 @@ module Enumerable
423
423
 
424
424
  self.$each.$$p = function() {
425
425
  var param = #{Opal.destructure(`arguments`)},
426
- value = $opal.$yield1(block, param);
426
+ value = Opal.yield1(block, param);
427
427
 
428
428
  if (value === $breaker) {
429
429
  result = $breaker.$v;
@@ -462,7 +462,7 @@ module Enumerable
462
462
  }
463
463
  else if (block !== nil) {
464
464
  self.$each.$$p = function() {
465
- var value = $opal.$yieldX(block, arguments);
465
+ var value = Opal.yieldX(block, arguments);
466
466
 
467
467
  if (value === $breaker) {
468
468
  result = $breaker.$v;
@@ -540,7 +540,7 @@ module Enumerable
540
540
  value = #{pattern === `param`};
541
541
 
542
542
  if (#{Opal.truthy?(`value`)}) {
543
- value = $opal.$yield1(block, param);
543
+ value = Opal.yield1(block, param);
544
544
 
545
545
  if (value === $breaker) {
546
546
  result = $breaker.$v;
@@ -578,7 +578,7 @@ module Enumerable
578
578
 
579
579
  self.$each.$$p = function() {
580
580
  var param = #{Opal.destructure(`arguments`)},
581
- value = $opal.$yield1(block, param);
581
+ value = Opal.yield1(block, param);
582
582
 
583
583
  if (value === $breaker) {
584
584
  result = $breaker.$v;
@@ -630,7 +630,7 @@ module Enumerable
630
630
  return;
631
631
  }
632
632
 
633
- value = $opal.$yieldX(block, [result, value]);
633
+ value = Opal.yieldX(block, [result, value]);
634
634
 
635
635
  if (value === $breaker) {
636
636
  result = $breaker.$v;
@@ -740,7 +740,7 @@ module Enumerable
740
740
 
741
741
  self.$each.$$p = function() {
742
742
  var param = #{Opal.destructure(`arguments`)},
743
- value = $opal.$yield1(block, param);
743
+ value = Opal.yield1(block, param);
744
744
 
745
745
  if (result === undefined) {
746
746
  result = param;
@@ -826,7 +826,7 @@ module Enumerable
826
826
 
827
827
  self.$each.$$p = function() {
828
828
  var param = #{Opal.destructure(`arguments`)},
829
- value = $opal.$yield1(block, param);
829
+ value = Opal.yield1(block, param);
830
830
 
831
831
  if (result === undefined) {
832
832
  result = param;
@@ -865,7 +865,7 @@ module Enumerable
865
865
 
866
866
  if (block !== nil) {
867
867
  self.$each.$$p = function() {
868
- var value = $opal.$yieldX(block, arguments);
868
+ var value = Opal.yieldX(block, arguments);
869
869
 
870
870
  if (value === $breaker) {
871
871
  result = $breaker.$v;
@@ -901,7 +901,7 @@ module Enumerable
901
901
 
902
902
  if (block !== nil) {
903
903
  self.$each.$$p = function() {
904
- var value = $opal.$yieldX(block, arguments);
904
+ var value = Opal.yieldX(block, arguments);
905
905
 
906
906
  if (value === $breaker) {
907
907
  result = $breaker.$v;
@@ -947,7 +947,7 @@ module Enumerable
947
947
 
948
948
  self.$each.$$p = function() {
949
949
  var param = #{Opal.destructure(`arguments`)},
950
- value = $opal.$yield1(block, param);
950
+ value = Opal.yield1(block, param);
951
951
 
952
952
  if (value === $breaker) {
953
953
  result = $breaker.$v;
@@ -978,7 +978,7 @@ module Enumerable
978
978
 
979
979
  self.$each.$$p = function() {
980
980
  var param = #{Opal.destructure(`arguments`)},
981
- value = $opal.$yield1(block, param);
981
+ value = Opal.yield1(block, param);
982
982
 
983
983
  if (value === $breaker) {
984
984
  result = $breaker.$v;
@@ -1009,7 +1009,7 @@ module Enumerable
1009
1009
  self.$each();
1010
1010
 
1011
1011
  for (var i = result.length - 1; i >= 0; i--) {
1012
- $opal.$yieldX(block, result[i]);
1012
+ Opal.yieldX(block, result[i]);
1013
1013
  }
1014
1014
 
1015
1015
  return result;
@@ -1031,7 +1031,7 @@ module Enumerable
1031
1031
  if (pattern === undefined) {
1032
1032
  self.$each.$$p = function() {
1033
1033
  var param = #{Opal.destructure(`arguments`)},
1034
- value = $opal.$yield1(block, param);
1034
+ value = Opal.yield1(block, param);
1035
1035
 
1036
1036
  if (#{Opal.truthy?(`value`)} && slice.length > 0) {
1037
1037
  #{e << `slice`};
@@ -1104,7 +1104,7 @@ module Enumerable
1104
1104
 
1105
1105
  self.$each.$$p = function() {
1106
1106
  var param = #{Opal.destructure(`arguments`)},
1107
- value = $opal.$yield1(block, param);
1107
+ value = Opal.yield1(block, param);
1108
1108
 
1109
1109
  if (value === $breaker) {
1110
1110
  result = $breaker.$v;