opal 1.3.2 → 1.4.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.js +1 -0
- data/.github/workflows/build.yml +0 -3
- data/.rubocop.yml +5 -1
- data/UNRELEASED.md +66 -2
- data/benchmark-ips/bm_truthy.rb +30 -0
- data/bin/opal-mspec +1 -3
- data/bin/opal-repl +1 -2
- data/bin/remove-filters +1 -4
- data/docs/compiled_ruby.md +10 -6
- data/exe/opal-repl +1 -3
- data/lib/opal/ast/builder.rb +1 -1
- data/lib/opal/cli.rb +2 -2
- data/lib/opal/cli_runners/nodejs.rb +9 -2
- data/lib/opal/cli_runners/source-map-support-browser.js +80 -216
- data/lib/opal/cli_runners/source-map-support-node.js +80 -216
- data/lib/opal/cli_runners/source-map-support.js +5 -1
- data/lib/opal/cli_runners/system_runner.rb +10 -4
- data/lib/opal/compiler.rb +3 -5
- data/lib/opal/fragment.rb +5 -1
- data/lib/opal/nodes/args/extract_block_arg.rb +1 -8
- data/lib/opal/nodes/args/extract_kwoptarg.rb +1 -3
- data/lib/opal/nodes/args/extract_optarg.rb +1 -3
- data/lib/opal/nodes/args/extract_post_arg.rb +2 -5
- data/lib/opal/nodes/args/extract_post_optarg.rb +2 -7
- data/lib/opal/nodes/args/initialize_iterarg.rb +1 -3
- data/lib/opal/nodes/args/prepare_post_args.rb +5 -1
- data/lib/opal/nodes/base.rb +3 -2
- data/lib/opal/nodes/call.rb +20 -9
- data/lib/opal/nodes/call_special.rb +50 -0
- data/lib/opal/nodes/class.rb +24 -15
- data/lib/opal/nodes/constants.rb +23 -5
- data/lib/opal/nodes/def.rb +20 -23
- data/lib/opal/nodes/defined.rb +5 -5
- data/lib/opal/nodes/definitions.rb +2 -2
- data/lib/opal/nodes/defs.rb +2 -5
- data/lib/opal/nodes/helpers.rb +48 -18
- data/lib/opal/nodes/if.rb +109 -8
- data/lib/opal/nodes/iter.rb +23 -16
- data/lib/opal/nodes/literal.rb +18 -4
- data/lib/opal/nodes/logic.rb +2 -1
- data/lib/opal/nodes/masgn.rb +4 -9
- data/lib/opal/nodes/module.rb +29 -19
- data/lib/opal/nodes/node_with_args.rb +1 -7
- data/lib/opal/nodes/scope.rb +54 -15
- data/lib/opal/nodes/singleton_class.rb +5 -3
- data/lib/opal/nodes/super.rb +3 -3
- data/lib/opal/nodes/top.rb +34 -31
- data/lib/opal/nodes/variables.rb +2 -2
- data/lib/opal/nodes/x_string.rb +3 -0
- data/lib/opal/nodes.rb +0 -1
- data/lib/opal/parser/patch.rb +75 -0
- data/lib/opal/parser/with_ruby_lexer.rb +1 -1
- data/lib/opal/regexp_anchors.rb +7 -7
- data/lib/opal/requires.rb +19 -0
- data/lib/opal/rewriters/pattern_matching.rb +1 -1
- data/lib/opal/rewriters/returnable_logic.rb +102 -4
- data/lib/opal/util.rb +2 -2
- data/lib/opal/version.rb +1 -1
- data/lib/opal.rb +1 -17
- data/opal/corelib/array/pack.rb +11 -11
- data/opal/corelib/array.rb +193 -152
- data/opal/corelib/basic_object.rb +14 -14
- data/opal/corelib/binding.rb +7 -7
- data/opal/corelib/boolean.rb +12 -15
- data/opal/corelib/class.rb +23 -1
- data/opal/corelib/comparable.rb +8 -8
- data/opal/corelib/complex/base.rb +2 -2
- data/opal/corelib/complex.rb +79 -88
- data/opal/corelib/constants.rb +9 -9
- data/opal/corelib/dir.rb +4 -3
- data/opal/corelib/enumerable.rb +140 -127
- data/opal/corelib/enumerator/arithmetic_sequence.rb +177 -0
- data/opal/corelib/enumerator/chain.rb +42 -0
- data/opal/corelib/enumerator/generator.rb +35 -0
- data/opal/corelib/enumerator/lazy.rb +243 -0
- data/opal/corelib/enumerator/yielder.rb +36 -0
- data/opal/corelib/enumerator.rb +45 -300
- data/opal/corelib/error/errno.rb +47 -0
- data/opal/corelib/error.rb +62 -60
- data/opal/corelib/file.rb +26 -12
- data/opal/corelib/hash.rb +98 -107
- data/opal/corelib/helpers.rb +62 -13
- data/opal/corelib/io.rb +47 -34
- data/opal/corelib/kernel/format.rb +29 -29
- data/opal/corelib/kernel.rb +86 -83
- data/opal/corelib/main.rb +14 -12
- data/opal/corelib/marshal/read_buffer.rb +15 -15
- data/opal/corelib/marshal/write_buffer.rb +45 -44
- data/opal/corelib/marshal.rb +3 -3
- data/opal/corelib/math.rb +50 -50
- data/opal/corelib/method.rb +12 -8
- data/opal/corelib/module.rb +96 -79
- data/opal/corelib/nil.rb +9 -11
- data/opal/corelib/number.rb +113 -118
- data/opal/corelib/numeric.rb +37 -33
- data/opal/corelib/object_space.rb +11 -10
- data/opal/corelib/pack_unpack/format_string_parser.rb +3 -3
- data/opal/corelib/pattern_matching/base.rb +7 -7
- data/opal/corelib/pattern_matching.rb +1 -1
- data/opal/corelib/proc.rb +15 -16
- data/opal/corelib/process/base.rb +2 -2
- data/opal/corelib/process/status.rb +21 -0
- data/opal/corelib/process.rb +5 -5
- data/opal/corelib/random/formatter.rb +11 -11
- data/opal/corelib/random/math_random.js.rb +1 -1
- data/opal/corelib/random/mersenne_twister.rb +3 -3
- data/opal/corelib/random/seedrandom.js.rb +3 -3
- data/opal/corelib/random.rb +17 -17
- data/opal/corelib/range.rb +51 -35
- data/opal/corelib/rational/base.rb +4 -4
- data/opal/corelib/rational.rb +61 -62
- data/opal/corelib/regexp.rb +47 -38
- data/opal/corelib/runtime.js +245 -139
- data/opal/corelib/string/encoding.rb +21 -21
- data/opal/corelib/string/unpack.rb +19 -14
- data/opal/corelib/string.rb +135 -128
- data/opal/corelib/struct.rb +59 -46
- data/opal/corelib/time.rb +47 -57
- data/opal/corelib/trace_point.rb +2 -2
- data/opal/corelib/unsupported.rb +31 -120
- data/opal/corelib/variables.rb +3 -3
- data/opal/opal/base.rb +9 -8
- data/opal/opal/full.rb +8 -8
- data/opal/opal/mini.rb +17 -17
- data/opal/opal.rb +17 -18
- data/opal.gemspec +1 -1
- data/spec/filters/bugs/array.rb +4 -24
- data/spec/filters/bugs/bigdecimal.rb +0 -23
- data/spec/filters/bugs/binding.rb +0 -1
- data/spec/filters/bugs/boolean.rb +3 -0
- data/spec/filters/bugs/class.rb +2 -0
- data/spec/filters/bugs/date.rb +0 -5
- data/spec/filters/bugs/encoding.rb +8 -50
- data/spec/filters/bugs/enumerable.rb +4 -1
- data/spec/filters/bugs/enumerator.rb +3 -36
- data/spec/filters/bugs/exception.rb +0 -2
- data/spec/filters/bugs/file.rb +0 -2
- data/spec/filters/bugs/float.rb +0 -3
- data/spec/filters/bugs/hash.rb +5 -3
- data/spec/filters/bugs/integer.rb +2 -3
- data/spec/filters/bugs/kernel.rb +2 -31
- data/spec/filters/bugs/language.rb +29 -49
- data/spec/filters/bugs/main.rb +0 -2
- data/spec/filters/bugs/marshal.rb +2 -3
- data/spec/filters/bugs/matrix.rb +0 -36
- data/spec/filters/bugs/module.rb +7 -61
- data/spec/filters/bugs/numeric.rb +0 -7
- data/spec/filters/bugs/objectspace.rb +1 -1
- data/spec/filters/bugs/pack_unpack.rb +0 -4
- data/spec/filters/bugs/proc.rb +0 -9
- data/spec/filters/bugs/random.rb +0 -5
- data/spec/filters/bugs/range.rb +1 -6
- data/spec/filters/bugs/regexp.rb +0 -3
- data/spec/filters/bugs/set.rb +8 -1
- data/spec/filters/bugs/string.rb +9 -34
- data/spec/filters/bugs/stringscanner.rb +8 -7
- data/spec/filters/bugs/struct.rb +2 -3
- data/spec/filters/bugs/symbol.rb +0 -1
- data/spec/filters/bugs/time.rb +0 -8
- data/spec/filters/bugs/unboundmethod.rb +0 -8
- data/spec/filters/bugs/warnings.rb +1 -7
- data/spec/filters/unsupported/freeze.rb +24 -0
- data/spec/filters/unsupported/integer.rb +1 -0
- data/spec/filters/unsupported/kernel.rb +12 -0
- data/spec/filters/unsupported/privacy.rb +3 -0
- data/spec/filters/unsupported/string.rb +2 -0
- data/spec/lib/builder_spec.rb +2 -2
- data/spec/lib/cli_spec.rb +1 -1
- data/spec/lib/compiler_spec.rb +37 -37
- data/spec/lib/simple_server_spec.rb +2 -2
- data/spec/lib/source_map/file_spec.rb +1 -1
- data/spec/opal/compiler/irb_spec.rb +2 -2
- data/spec/opal/core/kernel/puts_spec.rb +90 -0
- data/spec/opal/core/language/super_spec.rb +24 -0
- data/spec/ruby_specs +4 -2
- data/spec/support/rewriters_helper.rb +1 -1
- data/stdlib/bigdecimal.rb +7 -11
- data/stdlib/buffer/view.rb +2 -2
- data/stdlib/buffer.rb +2 -2
- data/stdlib/date.rb +5 -6
- data/stdlib/erb.rb +1 -0
- data/stdlib/js.rb +2 -1
- data/stdlib/native.rb +7 -8
- data/stdlib/nodejs/argf.rb +4 -4
- data/stdlib/nodejs/base.rb +29 -0
- data/stdlib/nodejs/dir.rb +1 -1
- data/stdlib/nodejs/env.rb +6 -9
- data/stdlib/nodejs/file.rb +23 -17
- data/stdlib/nodejs/fileutils.rb +3 -3
- data/stdlib/nodejs/io.rb +2 -20
- data/stdlib/nodejs/irb.rb +0 -0
- data/stdlib/nodejs/kernel.rb +2 -37
- data/stdlib/nodejs.rb +1 -3
- data/stdlib/opal/miniracer.rb +2 -0
- data/stdlib/opal/platform.rb +6 -13
- data/stdlib/opal/replutils.rb +16 -5
- data/stdlib/opal-parser.rb +2 -2
- data/stdlib/optparse/ac.rb +54 -0
- data/stdlib/optparse/date.rb +14 -0
- data/stdlib/optparse/kwargs.rb +22 -0
- data/stdlib/optparse/shellwords.rb +7 -0
- data/stdlib/optparse/time.rb +15 -0
- data/stdlib/optparse/uri.rb +7 -0
- data/stdlib/optparse/version.rb +69 -0
- data/stdlib/optparse.rb +2279 -0
- data/stdlib/pathname.rb +5 -6
- data/stdlib/pp.rb +18 -2
- data/stdlib/promise/v2.rb +18 -22
- data/stdlib/promise.rb +15 -21
- data/stdlib/set.rb +32 -32
- data/stdlib/shellwords.rb +240 -0
- data/stdlib/stringio.rb +3 -6
- data/stdlib/strscan.rb +5 -8
- data/stdlib/template.rb +2 -2
- data/stdlib/thread.rb +7 -9
- data/tasks/performance.rake +5 -2
- data/tasks/testing/mspec_special_calls.rb +0 -12
- data/tasks/testing.rake +55 -37
- data/test/nodejs/test_file.rb +11 -0
- metadata +55 -10
- data/lib/opal/nodes/case.rb +0 -114
data/opal/corelib/regexp.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# helpers: coerce_to
|
2
2
|
|
3
|
-
class RegexpError < StandardError; end
|
3
|
+
class ::RegexpError < ::StandardError; end
|
4
4
|
|
5
|
-
class Regexp < `RegExp`
|
6
|
-
IGNORECASE = 1
|
7
|
-
EXTENDED = 2
|
8
|
-
MULTILINE = 4
|
5
|
+
class ::Regexp < `RegExp`
|
6
|
+
self::IGNORECASE = 1
|
7
|
+
self::EXTENDED = 2
|
8
|
+
self::MULTILINE = 4
|
9
9
|
|
10
|
-
`Opal.
|
10
|
+
`Opal.prop(self.$$prototype, '$$is_regexp', true)`
|
11
11
|
|
12
12
|
class << self
|
13
13
|
def allocate
|
@@ -28,8 +28,6 @@ class Regexp < `RegExp`
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
alias quote escape
|
32
|
-
|
33
31
|
def union(*parts)
|
34
32
|
%x{
|
35
33
|
var is_first_part_array, quoted_validated, part, options, each_part_options;
|
@@ -43,7 +41,7 @@ class Regexp < `RegExp`
|
|
43
41
|
// cover the 2 arrays passed as arguments case
|
44
42
|
is_first_part_array = parts[0].$$is_array;
|
45
43
|
if (parts.length > 1 && is_first_part_array) {
|
46
|
-
#{raise TypeError, 'no implicit conversion of Array into String'}
|
44
|
+
#{::Kernel.raise ::TypeError, 'no implicit conversion of Array into String'}
|
47
45
|
}
|
48
46
|
// deal with splat issues (related to https://github.com/opal/opal/issues/858)
|
49
47
|
if (is_first_part_array) {
|
@@ -59,7 +57,7 @@ class Regexp < `RegExp`
|
|
59
57
|
else if (part.$$is_regexp) {
|
60
58
|
each_part_options = #{`part`.options};
|
61
59
|
if (options != undefined && options != each_part_options) {
|
62
|
-
#{raise TypeError, 'All expressions must use the same options'}
|
60
|
+
#{::Kernel.raise ::TypeError, 'All expressions must use the same options'}
|
63
61
|
}
|
64
62
|
options = each_part_options;
|
65
63
|
quoted_validated.push('('+part.source+')');
|
@@ -79,10 +77,10 @@ class Regexp < `RegExp`
|
|
79
77
|
return new RegExp(regexp);
|
80
78
|
}
|
81
79
|
|
82
|
-
regexp = #{Opal.coerce_to!(regexp, String, :to_str)};
|
80
|
+
regexp = #{::Opal.coerce_to!(regexp, ::String, :to_str)};
|
83
81
|
|
84
82
|
if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') {
|
85
|
-
#{raise RegexpError, "too short escape sequence: /#{regexp}/"}
|
83
|
+
#{::Kernel.raise ::RegexpError, "too short escape sequence: /#{regexp}/"}
|
86
84
|
}
|
87
85
|
|
88
86
|
if (options === undefined || #{!options}) {
|
@@ -104,6 +102,7 @@ class Regexp < `RegExp`
|
|
104
102
|
end
|
105
103
|
|
106
104
|
alias compile new
|
105
|
+
alias quote escape
|
107
106
|
end
|
108
107
|
|
109
108
|
def ==(other)
|
@@ -111,15 +110,13 @@ class Regexp < `RegExp`
|
|
111
110
|
end
|
112
111
|
|
113
112
|
def ===(string)
|
114
|
-
`#{match(Opal.coerce_to?(string, String, :to_str))} !== nil`
|
113
|
+
`#{match(::Opal.coerce_to?(string, ::String, :to_str))} !== nil`
|
115
114
|
end
|
116
115
|
|
117
116
|
def =~(string)
|
118
117
|
match(string) && $~.begin(0)
|
119
118
|
end
|
120
119
|
|
121
|
-
alias eql? ==
|
122
|
-
|
123
120
|
def inspect
|
124
121
|
# Use a regexp to extract the regular expression and the optional mode modifiers from the string.
|
125
122
|
# In the regular expression, escape any front slash (not already escaped) with a backslash.
|
@@ -161,27 +158,27 @@ class Regexp < `RegExp`
|
|
161
158
|
def match(string, pos = undefined, &block)
|
162
159
|
%x{
|
163
160
|
if (self.uninitialized) {
|
164
|
-
#{raise TypeError, 'uninitialized Regexp'}
|
161
|
+
#{::Kernel.raise ::TypeError, 'uninitialized Regexp'}
|
165
162
|
}
|
166
163
|
|
167
164
|
if (pos === undefined) {
|
168
165
|
if (string === nil) return #{$~ = nil};
|
169
|
-
var m = self.exec($coerce_to(string, #{String}, 'to_str'));
|
166
|
+
var m = self.exec($coerce_to(string, #{::String}, 'to_str'));
|
170
167
|
if (m) {
|
171
|
-
#{$~ = MatchData.new(`self`, `m`)};
|
168
|
+
#{$~ = ::MatchData.new(`self`, `m`)};
|
172
169
|
return block === nil ? #{$~} : #{yield $~};
|
173
170
|
} else {
|
174
171
|
return #{$~ = nil};
|
175
172
|
}
|
176
173
|
}
|
177
174
|
|
178
|
-
pos = $coerce_to(pos, #{Integer}, 'to_int');
|
175
|
+
pos = $coerce_to(pos, #{::Integer}, 'to_int');
|
179
176
|
|
180
177
|
if (string === nil) {
|
181
178
|
return #{$~ = nil};
|
182
179
|
}
|
183
180
|
|
184
|
-
string = $coerce_to(string, #{String}, 'to_str');
|
181
|
+
string = $coerce_to(string, #{::String}, 'to_str');
|
185
182
|
|
186
183
|
if (pos < 0) {
|
187
184
|
pos += string.length;
|
@@ -199,7 +196,7 @@ class Regexp < `RegExp`
|
|
199
196
|
return #{$~ = nil};
|
200
197
|
}
|
201
198
|
if (md.index >= pos) {
|
202
|
-
#{$~ = MatchData.new(`re`, `md`)};
|
199
|
+
#{$~ = ::MatchData.new(`re`, `md`)};
|
203
200
|
return block === nil ? #{$~} : #{yield $~};
|
204
201
|
}
|
205
202
|
re.lastIndex = md.index + 1;
|
@@ -210,20 +207,20 @@ class Regexp < `RegExp`
|
|
210
207
|
def match?(string, pos = undefined)
|
211
208
|
%x{
|
212
209
|
if (self.uninitialized) {
|
213
|
-
#{raise TypeError, 'uninitialized Regexp'}
|
210
|
+
#{::Kernel.raise ::TypeError, 'uninitialized Regexp'}
|
214
211
|
}
|
215
212
|
|
216
213
|
if (pos === undefined) {
|
217
|
-
return string === nil ? false : self.test($coerce_to(string, #{String}, 'to_str'));
|
214
|
+
return string === nil ? false : self.test($coerce_to(string, #{::String}, 'to_str'));
|
218
215
|
}
|
219
216
|
|
220
|
-
pos = $coerce_to(pos, #{Integer}, 'to_int');
|
217
|
+
pos = $coerce_to(pos, #{::Integer}, 'to_int');
|
221
218
|
|
222
219
|
if (string === nil) {
|
223
220
|
return false;
|
224
221
|
}
|
225
222
|
|
226
|
-
string = $coerce_to(string, #{String}, 'to_str');
|
223
|
+
string = $coerce_to(string, #{::String}, 'to_str');
|
227
224
|
|
228
225
|
if (pos < 0) {
|
229
226
|
pos += string.length;
|
@@ -270,7 +267,7 @@ class Regexp < `RegExp`
|
|
270
267
|
# Flags would be nice to use with this, but still experimental - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags
|
271
268
|
%x{
|
272
269
|
if (self.uninitialized) {
|
273
|
-
#{raise TypeError, 'uninitialized Regexp'}
|
270
|
+
#{::Kernel.raise ::TypeError, 'uninitialized Regexp'}
|
274
271
|
}
|
275
272
|
var result = 0;
|
276
273
|
// should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx
|
@@ -288,14 +285,15 @@ class Regexp < `RegExp`
|
|
288
285
|
`self.ignoreCase`
|
289
286
|
end
|
290
287
|
|
288
|
+
alias eql? ==
|
291
289
|
alias to_s source
|
292
290
|
end
|
293
291
|
|
294
292
|
class MatchData
|
295
293
|
attr_reader :post_match, :pre_match, :regexp, :string
|
296
294
|
|
297
|
-
def initialize(regexp, match_groups)
|
298
|
-
$~ = self
|
295
|
+
def initialize(regexp, match_groups, no_matchdata: false)
|
296
|
+
$~ = self unless no_matchdata
|
299
297
|
@regexp = regexp
|
300
298
|
@begin = `match_groups.index`
|
301
299
|
@string = `match_groups.input`
|
@@ -317,11 +315,23 @@ class MatchData
|
|
317
315
|
}
|
318
316
|
end
|
319
317
|
|
318
|
+
def match(idx)
|
319
|
+
if (match = self[idx])
|
320
|
+
match
|
321
|
+
elsif idx.is_a?(Integer) && idx >= length
|
322
|
+
::Kernel.raise ::IndexError, "index #{idx} out of matches"
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
def match_length(idx)
|
327
|
+
match(idx)&.length
|
328
|
+
end
|
329
|
+
|
320
330
|
def [](*args)
|
321
331
|
%x{
|
322
332
|
if (args[0].$$is_string) {
|
323
333
|
if (#{!regexp.names.include?(args[0])}) {
|
324
|
-
#{raise IndexError, "undefined group name reference: #{args[0]}"}
|
334
|
+
#{::Kernel.raise ::IndexError, "undefined group name reference: #{args[0]}"}
|
325
335
|
}
|
326
336
|
return #{named_captures[args[0]]}
|
327
337
|
}
|
@@ -334,14 +344,14 @@ class MatchData
|
|
334
344
|
def offset(n)
|
335
345
|
%x{
|
336
346
|
if (n !== 0) {
|
337
|
-
#{raise ArgumentError, 'MatchData#offset only supports 0th element'}
|
347
|
+
#{::Kernel.raise ::ArgumentError, 'MatchData#offset only supports 0th element'}
|
338
348
|
}
|
339
349
|
return [self.begin, self.begin + self.matches[n].length];
|
340
350
|
}
|
341
351
|
end
|
342
352
|
|
343
353
|
def ==(other)
|
344
|
-
return false unless MatchData === other
|
354
|
+
return false unless ::MatchData === other
|
345
355
|
|
346
356
|
`self.string == other.string` &&
|
347
357
|
`self.regexp.toString() == other.regexp.toString()` &&
|
@@ -350,12 +360,10 @@ class MatchData
|
|
350
360
|
`self.begin == other.begin`
|
351
361
|
end
|
352
362
|
|
353
|
-
alias eql? ==
|
354
|
-
|
355
363
|
def begin(n)
|
356
364
|
%x{
|
357
365
|
if (n !== 0) {
|
358
|
-
#{raise ArgumentError, 'MatchData#begin only supports 0th element'}
|
366
|
+
#{::Kernel.raise ::ArgumentError, 'MatchData#begin only supports 0th element'}
|
359
367
|
}
|
360
368
|
return self.begin;
|
361
369
|
}
|
@@ -364,7 +372,7 @@ class MatchData
|
|
364
372
|
def end(n)
|
365
373
|
%x{
|
366
374
|
if (n !== 0) {
|
367
|
-
#{raise ArgumentError, 'MatchData#end only supports 0th element'}
|
375
|
+
#{::Kernel.raise ::ArgumentError, 'MatchData#end only supports 0th element'}
|
368
376
|
}
|
369
377
|
return self.begin + self.matches[n].length;
|
370
378
|
}
|
@@ -410,8 +418,6 @@ class MatchData
|
|
410
418
|
`#{@matches}.length`
|
411
419
|
end
|
412
420
|
|
413
|
-
alias size length
|
414
|
-
|
415
421
|
def to_a
|
416
422
|
@matches
|
417
423
|
end
|
@@ -432,7 +438,7 @@ class MatchData
|
|
432
438
|
Array.prototype.splice.apply(args, a);
|
433
439
|
}
|
434
440
|
|
435
|
-
index = #{Opal.coerce_to!(`args[i]`, Integer, :to_int)};
|
441
|
+
index = #{::Opal.coerce_to!(`args[i]`, ::Integer, :to_int)};
|
436
442
|
|
437
443
|
if (index < 0) {
|
438
444
|
index += #{@matches}.length;
|
@@ -448,4 +454,7 @@ class MatchData
|
|
448
454
|
return values;
|
449
455
|
}
|
450
456
|
end
|
457
|
+
|
458
|
+
alias eql? ==
|
459
|
+
alias size length
|
451
460
|
end
|