Skip to content

Commit

Permalink
Support Module#autoload in RequireParser
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 8, 2013
1 parent fcbfac5 commit a336419
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions corelib/module.rb
Expand Up @@ -394,6 +394,8 @@ def public(*)
alias private public
alias protected public

alias public_instance_methods instance_methods

alias public_method_defined? method_defined?

def remove_class_variable(*)
Expand Down
6 changes: 6 additions & 0 deletions lib/opal/parser.rb
Expand Up @@ -815,6 +815,12 @@ def process_call(sexp, level)
case meth
when :block_given?
return js_block_given(sexp, level)
when :__method__, :__callee__
if @scope.def?
return f(@scope.mid.to_s.inspect)
else
return f("nil")
end
end

splat = arglist[1..-1].any? { |a| a.first == :splat }
Expand Down
2 changes: 2 additions & 0 deletions lib/opal/require_parser.rb
Expand Up @@ -20,6 +20,8 @@ def parse source, options = {}
def process_call sexp, level
if sexp[1] == :require
return handle_require sexp[2][1]
elsif sexp[1] == :autoload and @scope.class_scope?
return handle_require sexp[2][2]
end

super sexp, level
Expand Down

0 comments on commit a336419

Please sign in to comment.