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: 47a0ae93dc6e
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5fca5b1c7c2b
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Apr 24, 2015

  1. Enable inline_operators by default

    Pass failing rubyspecs for String and Array inheritance
    vais committed Apr 24, 2015
    Copy the full SHA
    ef5e16f View commit details
  2. Merge pull request #809 from vais/default-inline-operators

    Enable inline_operators by default
    elia committed Apr 24, 2015
    Copy the full SHA
    5fca5b1 View commit details
Showing with 27 additions and 2 deletions.
  1. +1 −1 lib/opal/compiler.rb
  2. +1 −1 lib/opal/sprockets/processor.rb
  3. +8 −0 opal/corelib/array/inheritance.rb
  4. +17 −0 opal/corelib/string/inheritance.rb
2 changes: 1 addition & 1 deletion lib/opal/compiler.rb
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ def self.compiler_option(name, default_value, options = {})
# @!method inline_operators?
#
# are operators compiled inline
compiler_option :inline_operators, false, :as => :inline_operators?
compiler_option :inline_operators, true, :as => :inline_operators?

# @return [String] The compiled ruby code
attr_reader :result
2 changes: 1 addition & 1 deletion lib/opal/sprockets/processor.rb
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ class << self
self.dynamic_require_severity = :error # :error, :warning or :ignore
self.source_map_enabled = true
self.irb_enabled = false
self.inline_operators_enabled = false
self.inline_operators_enabled = true


def evaluate(context, locals, &block)
8 changes: 8 additions & 0 deletions opal/corelib/array/inheritance.rb
Original file line number Diff line number Diff line change
@@ -116,4 +116,12 @@ def uniq
def flatten(level = undefined)
self.class.allocate(@literal.flatten(level))
end

def -(other)
@literal - other
end

def +(other)
@literal + other
end
end
17 changes: 17 additions & 0 deletions opal/corelib/string/inheritance.rb
Original file line number Diff line number Diff line change
@@ -75,4 +75,21 @@ def to_s
def inspect
@literal.inspect
end

def +(other)
@literal + other
end

def *(other)
%x{
var result = #{@literal * other};
if (result.$$is_string) {
return #{self.class.allocate(`result`)}
}
else {
return result;
}
}
end
end