Skip to content

Commit

Permalink
Merge branch 'parser-tokens'
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Nov 23, 2013
2 parents 9dce5f9 + 237976b commit ad1f4e2
Show file tree
Hide file tree
Showing 65 changed files with 3,996 additions and 3,871 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -15,3 +15,7 @@ notifications:
matrix:
allow_failures:
- rvm: rbx-20mode

branches:
except:
- parser-tokens
8 changes: 3 additions & 5 deletions lib/opal/compiler.rb
Expand Up @@ -107,9 +107,7 @@ def parser_indent
# returns an array, it must be used incase the internal structure
# of sexps does change.
def s(*parts)
sexp = Sexp.new(parts)
sexp.line = @line
sexp
Sexp.new(parts)
end

def fragment(str, sexp = nil)
Expand Down Expand Up @@ -181,7 +179,7 @@ def in_while?
# and compiling it to fragments.
def process(sexp, level = :expr)
if handler = handlers[sexp.type]
@line = sexp.line
#@line = sexp.line
return handler.new(sexp, level, self).compile_to_fragments
else
raise "Unsupported sexp: #{sexp.type}"
Expand Down Expand Up @@ -268,7 +266,7 @@ def returns(sexp)
sexp
else
s(:js_return, sexp).tap { |s|
s.line = sexp.line
#s.line = sexp.line
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/fragment.rb
Expand Up @@ -16,7 +16,7 @@ def initialize(code, sexp = nil)
# In debug mode we may wish to include the original line as a comment
def to_code
if @sexp
"/*:#{@sexp.line}*/#{@code}"
"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}"
else
@code
end
Expand Down
8 changes: 7 additions & 1 deletion lib/opal/nodes/logic.rb
Expand Up @@ -148,7 +148,13 @@ class ReturnNode < Base
children :value

def return_val
expr_or_nil value
if value.nil?
expr(s(:nil))
elsif children.size > 1
expr(s(:array, *children))
else
expr(value)
end
end

def return_in_iter?
Expand Down
4 changes: 2 additions & 2 deletions lib/opal/nodes/module.rb
Expand Up @@ -31,8 +31,8 @@ def compile
end

def name_and_base
if Symbol === cid or String === cid
[cid.to_s, 'self']
if cid.type == :const
[cid[1].to_s, 'self']
elsif cid.type == :colon2
[cid[2].to_s, expr(cid[1])]
elsif cid.type == :colon3
Expand Down

0 comments on commit ad1f4e2

Please sign in to comment.