Skip to content

Commit ad1f4e2

Browse files
committed
Merge branch 'parser-tokens'
2 parents 9dce5f9 + 237976b commit ad1f4e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3996
-3871
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ notifications:
1515
matrix:
1616
allow_failures:
1717
- rvm: rbx-20mode
18+
19+
branches:
20+
except:
21+
- parser-tokens

lib/opal/compiler.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ def parser_indent
107107
# returns an array, it must be used incase the internal structure
108108
# of sexps does change.
109109
def s(*parts)
110-
sexp = Sexp.new(parts)
111-
sexp.line = @line
112-
sexp
110+
Sexp.new(parts)
113111
end
114112

115113
def fragment(str, sexp = nil)
@@ -181,7 +179,7 @@ def in_while?
181179
# and compiling it to fragments.
182180
def process(sexp, level = :expr)
183181
if handler = handlers[sexp.type]
184-
@line = sexp.line
182+
#@line = sexp.line
185183
return handler.new(sexp, level, self).compile_to_fragments
186184
else
187185
raise "Unsupported sexp: #{sexp.type}"
@@ -268,7 +266,7 @@ def returns(sexp)
268266
sexp
269267
else
270268
s(:js_return, sexp).tap { |s|
271-
s.line = sexp.line
269+
#s.line = sexp.line
272270
}
273271
end
274272
end

lib/opal/fragment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(code, sexp = nil)
1616
# In debug mode we may wish to include the original line as a comment
1717
def to_code
1818
if @sexp
19-
"/*:#{@sexp.line}*/#{@code}"
19+
"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}"
2020
else
2121
@code
2222
end

lib/opal/nodes/logic.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ class ReturnNode < Base
148148
children :value
149149

150150
def return_val
151-
expr_or_nil value
151+
if value.nil?
152+
expr(s(:nil))
153+
elsif children.size > 1
154+
expr(s(:array, *children))
155+
else
156+
expr(value)
157+
end
152158
end
153159

154160
def return_in_iter?

lib/opal/nodes/module.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def compile
3131
end
3232

3333
def name_and_base
34-
if Symbol === cid or String === cid
35-
[cid.to_s, 'self']
34+
if cid.type == :const
35+
[cid[1].to_s, 'self']
3636
elsif cid.type == :colon2
3737
[cid[2].to_s, expr(cid[1])]
3838
elsif cid.type == :colon3

0 commit comments

Comments
 (0)