-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move require() and auotload() resolve logic into DependencyResolver c…
…lass
- Loading branch information
1 parent
515efb9
commit 0a30293
Showing
7 changed files
with
153 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Opal | ||
|
||
[Method Missing](method_missing.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ | |
require 'opal/nodes/array' | ||
require 'opal/nodes/defined' | ||
require 'opal/nodes/masgn' | ||
require 'opal/nodes/arglist' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require 'opal/nodes/base' | ||
|
||
module Opal | ||
module Nodes | ||
# FIXME: needs rewrite | ||
class ArglistNode < Base | ||
handle :arglist | ||
|
||
def compile | ||
code, work = [], [] | ||
|
||
children.each do |current| | ||
splat = current.first == :splat | ||
arg = expr(current) | ||
|
||
if splat | ||
if work.empty? | ||
if code.empty? | ||
code << fragment("[].concat(") | ||
code << arg | ||
code << fragment(")") | ||
else | ||
code += ".concat(#{arg})" | ||
end | ||
else | ||
if code.empty? | ||
code << [fragment("["), work, fragment("]")] | ||
else | ||
code << [fragment(".concat(["), work, fragment("])")] | ||
end | ||
|
||
code << [fragment(".concat("), arg, fragment(")")] | ||
end | ||
|
||
work = [] | ||
else | ||
work << fragment(", ") unless work.empty? | ||
work << arg | ||
end | ||
end | ||
|
||
unless work.empty? | ||
join = work | ||
|
||
if code.empty? | ||
code = join | ||
else | ||
code << fragment(".concat(") << join << fragment(")") | ||
end | ||
end | ||
|
||
push(*code) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters