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

Commits on Oct 31, 2014

  1. Reorder Kernel methods

    elia committed Oct 31, 2014
    Copy the full SHA
    8fddadd View commit details
  2. Copy the full SHA
    a9d5a97 View commit details
  3. Avoid expand_path in require_relative

    The problem is that at compiler level there’s no reference to the file
    on disk or to its path. This makes require_relative a bit less correct
    but fixes it for most cases.
    
    Fixes #626
    elia committed Oct 31, 2014
    Copy the full SHA
    9cd638c View commit details
Showing with 50 additions and 40 deletions.
  1. +2 −1 lib/opal/nodes/call.rb
  2. +48 −39 opal/corelib/kernel.rb
3 changes: 2 additions & 1 deletion lib/opal/nodes/call.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'set'
require 'pathname'
require 'opal/nodes/base'
require 'opal/nodes/runtime_helpers'

@@ -172,7 +173,7 @@ def compile_default?
file = compiler.file
if arg[0] == :str
dir = File.dirname(file)
compiler.requires << File.expand_path(arg[1], dir)
compiler.requires << Pathname(dir).join(arg[1]).cleanpath.to_s
end
push fragment("self.$require(#{file.inspect}+ '/../' + ")
push process(arglist)
87 changes: 48 additions & 39 deletions opal/corelib/kernel.rb
Original file line number Diff line number Diff line change
@@ -288,6 +288,15 @@ def format(format, *args)
}
end

def freeze
@___frozen___ = true
self
end

def frozen?
@___frozen___ || false
end

def hash
`[self.$$class.$$name,#{`self.$$class`.__id__},#{__id__}].join(':')`
end
@@ -395,6 +404,10 @@ def lambda(&block)
block
end

def load(file)
`Opal.load(Opal.normalize_loadable_path(#{file}))`
end

def loop(&block)
%x{
while (true) {
@@ -489,8 +502,6 @@ def rand(max = undefined)
}
end

alias srand rand

def respond_to?(name, include_all = false)
return true if respond_to_missing?(name)

@@ -505,41 +516,6 @@ def respond_to?(name, include_all = false)
false
end

alias send __send__
alias public_send __send__

def singleton_class
%x{Opal.get_singleton_class(self)}
end

alias sprintf format

def String(str)
`String(str)`
end

def tap(&block)
yield self
self
end

def to_proc
self
end

def to_s
"#<#{self.class}:0x#{__id__.to_s(16)}>"
end

def freeze
@___frozen___ = true
self
end

def frozen?
@___frozen___ || false
end

def respond_to_missing?(method_name)
false
end
@@ -569,8 +545,41 @@ def require_tree(path)
nil
end

def load(file)
`Opal.load(Opal.normalize_loadable_path(#{file}))`
alias send __send__
alias public_send __send__

def singleton_class
%x{Opal.get_singleton_class(self)}
end

alias sprintf format

alias srand rand

def String(str)
`String(str)`
end

def taint
self
end

def tainted?
false
end

def tap(&block)
yield self
self
end

def to_proc
self
end

def to_s
"#<#{self.class}:0x#{__id__.to_s(16)}>"
end

alias untaint taint
end