Skip to content

Commit

Permalink
Fix some ternary operators inside #process_defined
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Oct 12, 2013
1 parent c7a1b52 commit 290f9cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/opal/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,9 @@ def process_defined(sexp, level)
f("local-variable", sexp)
when :gvar
gvar_name = part[1].to_s[1..-1]
f("($hasOwn.call($gvars, #{gvar_name.inspect}) ? 'global-variable', : nil)", sexp)
f("($gvars.hasOwnProperty(#{gvar_name.inspect}) != null ? 'global-variable' : nil)", sexp)
when :yield
f("(#{js_block_given(sexp, level)} ? 'yield' : nil)", sexp)
[f('( (', sexp), js_block_given(sexp, level), f(") != null ? 'yield' : nil)", sexp)]
when :lasgn, :iasgn, :gasgn, :cvdecl, :masgn,
:op_asgn_or, :op_asgn_and
f("'assignment'", sexp)
Expand All @@ -660,7 +660,7 @@ def process_defined(sexp, level)
f("'expression'", sexp)
when :nth_ref
gvar_name = "$#{part[1].to_s[1..-1]}"
f("($hasOwn.call($gvars, #{gvar_name.inspect}) ? 'global-variable', : nil)", sexp)
f("( ($gvars.hasOwnProperty(#{gvar_name.inspect}) != null) ? 'global-variable' : nil)", sexp)
else
raise "bad defined? part: #{part[0]} (full sexp: #{part.inspect})"
end
Expand Down

0 comments on commit 290f9cb

Please sign in to comment.