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: a168ac6f2001
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1e26f92cc3f9
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Mar 30, 2015

  1. Copy the full SHA
    bc10a4e View commit details
  2. Load opal right away

    Not doing so can cause errors while interacting with external code if 
    such code is executed between corelib/runtime.js and Opal.load(‘opal’).
    
    e.g. runtime.js forwards Array.prototype.toString() to Array.prototype.$to_s()
         but $to_s is implemented only when corelib/array is loaded.
    elia committed Mar 30, 2015
    Copy the full SHA
    1e26f92 View commit details
Showing with 10 additions and 2 deletions.
  1. +9 −1 lib/opal/sprockets/processor.rb
  2. +1 −1 lib/opal/version.rb
10 changes: 9 additions & 1 deletion lib/opal/sprockets/processor.rb
Original file line number Diff line number Diff line change
@@ -69,6 +69,14 @@ def evaluate(context, locals, &block)
logical_path = context.logical_path
compiler_options = self.compiler_options.merge(file: logical_path)

# Opal will be loaded immediately to as the runtime redefines some crucial
# methods such that need to be implemented as soon as possible:
#
# E.g. It forwards .toString() to .$to_s() for Opal objects including Array.
# If .$to_s() is not implemented and some other lib is loaded before
# corelib/* .toString results in an `undefined is not a function` error.
compiler_options.merge!(requirable: false) if logical_path == 'opal'

compiler = Compiler.new(data, compiler_options)
result = compiler.compile

@@ -105,7 +113,7 @@ def self.load_asset_code(sprockets, name)
.select { |asset| not(processed_by_opal[asset, sprockets]) }
.map { |asset| module_name[asset] }

mark_as_loaded = (non_opal_assets + stubbed_files.to_a)
mark_as_loaded = (['opal'] + non_opal_assets + stubbed_files.to_a)
.map { |path| mark_as_loaded[path] }

if processed_by_opal[asset, sprockets]
2 changes: 1 addition & 1 deletion lib/opal/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Opal
VERSION = '0.7.1'
VERSION = '0.8.0.dev'
end