Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 672ff686019b
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0df6db6595d0
Choose a head ref
  • 4 commits
  • 7 files changed
  • 1 contributor

Commits on Nov 28, 2013

  1. 2
    Copy the full SHA
    a5acf46 View commit details
  2. Copy the full SHA
    36cf81c View commit details
  3. Remove some old comments

    adambeynon committed Nov 28, 2013
    Copy the full SHA
    faa2b68 View commit details
  4. Copy the full SHA
    0df6db6 View commit details
Showing with 16 additions and 52 deletions.
  1. +0 −19 opal/corelib/array.rb
  2. +0 −14 opal/corelib/helpers.rb
  3. +0 −2 opal/corelib/kernel.rb
  4. +0 −6 opal/corelib/module.rb
  5. +0 −11 opal/corelib/time.rb
  6. +7 −0 spec/opal/filters/unsupported/integer_size.rb
  7. +9 −0 stdlib/time.rb
19 changes: 0 additions & 19 deletions opal/corelib/array.rb
Original file line number Diff line number Diff line change
@@ -255,8 +255,6 @@ def [](index, length = undefined)
}
}
#{Opal.fits_fixnum!(`from`)};
if (from > size) {
return nil;
}
@@ -269,8 +267,6 @@ def [](index, length = undefined)
}
}
#{Opal.fits_fixnum!(`to`)};
if (!exclude) {
to += 1;
}
@@ -291,8 +287,6 @@ def [](index, length = undefined)
}
}
#{Opal.fits_fixnum!(`index`)};
if (length === undefined) {
if (index >= size || index < 0) {
return nil;
@@ -303,8 +297,6 @@ def [](index, length = undefined)
else {
length = #{Opal.coerce_to length, Integer, :to_int};
#{Opal.fits_fixnum!(`length`)};
if (length < 0 || index > size || index < 0) {
return nil;
}
@@ -339,14 +331,10 @@ def []=(index, value, extra = undefined)
}
}
#{Opal.fits_fixnum!(`from`)};
if (to < 0) {
to += size;
}
#{Opal.fits_fixnum!(`to`)};
if (!exclude) {
to += 1;
}
@@ -397,14 +385,10 @@ def []=(index, value, extra = undefined)
}
}
#{Opal.fits_fixnum!(`index`)};
if (length < 0) {
#{raise IndexError, "negative length (#{length})"}
}
#{Opal.fits_fixnum!(`length`)};
if (index > size) {
for (var i = size; i < index; i++) {
self[i] = nil;
@@ -811,9 +795,6 @@ def fill(*args, &block)
right = @length
end

Opal.fits_fixnum!(right)
Opal.fits_array!(right)

if `left > #@length`
%x{
for (var i = #@length; i < right; i++) {
14 changes: 0 additions & 14 deletions opal/corelib/helpers.rb
Original file line number Diff line number Diff line change
@@ -37,20 +37,6 @@ def self.compare(a, b)
compare
end

def self.fits_fixnum!(value)
# since we have Fixnum#size as 32 bit, this is based on the int limits
if `value > 2147483648`
raise RangeError, "bignum too big to convert into `long'"
end
end

def self.fits_array!(value)
# this is the computed ARY_MAX_SIZE for 32 bit
if `value >= 536870910`
raise ArgumentError, "argument too big"
end
end

def self.destructure(args)
%x{
if (args.length == 1) {
2 changes: 0 additions & 2 deletions opal/corelib/kernel.rb
Original file line number Diff line number Diff line change
@@ -104,7 +104,6 @@ def clone
def initialize_clone(other)
initialize_copy(other)
end
private :initialize_clone

def define_singleton_method(name, &body)
unless body
@@ -135,7 +134,6 @@ def dup
def initialize_dup(other)
initialize_copy(other)
end
private :initialize_dup

def enum_for(method = :each, *args, &block)
Enumerator.for(self, method, *args, &block)
6 changes: 0 additions & 6 deletions opal/corelib/module.rb
Original file line number Diff line number Diff line change
@@ -180,10 +180,6 @@ def attr_writer(*names)

alias attr attr_accessor

# when self is Module (or Class), implement 1st form:
# - global constants, classes and modules in global scope
# when self is not Module (or Class), implement 2nd form:
# - constants, classes and modules scoped to instance
def constants
`#{self}._scope.constants`
end
@@ -213,8 +209,6 @@ def const_defined?(name, inherit = true)
}
end

# check for constant within current scope
# if inherit is true or self is Object, will also check ancestors
def const_get(name, inherit = true)
raise NameError, "wrong constant name #{name}" unless name =~ /^[A-Z]\w*$/

11 changes: 0 additions & 11 deletions opal/corelib/time.rb
Original file line number Diff line number Diff line change
@@ -509,14 +509,3 @@ def year
`self.getFullYear()`
end
end

# FIXME: move this to stdlib when the corelib has its own path
class Time
def self.parse(str)
`new Date(Date.parse(str))`
end

def iso8601
strftime('%FT%T%z')
end
end
7 changes: 7 additions & 0 deletions spec/opal/filters/unsupported/integer_size.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opal_filter "fixnum and array size" do
fails "Array#slice raises a RangeError when the length is out of range of Fixnum"
fails "Array#slice raises a RangeError when the start index is out of range of Fixnum"
fails "Array#fill with (filler, index, length) raises an ArgumentError or RangeError for too-large sizes"
fails "Array#[] raises a RangeError when the length is out of range of Fixnum"
fails "Array#[] raises a RangeError when the start index is out of range of Fixnum"
end
9 changes: 9 additions & 0 deletions stdlib/time.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Time
def self.parse(str)
`new Date(Date.parse(str))`
end

def iso8601
strftime('%FT%T%z')
end
end