Skip to content

Commit

Permalink
Add special handler for 'debugger' method to run javascript debugger
Browse files Browse the repository at this point in the history
The 'debugger' method call simply generates the debugger javascript
keyword to load the debugger at the given location.
  • Loading branch information
adambeynon committed Nov 26, 2013
1 parent 8ba881b commit b10658b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/opal/nodes/call.rb
Expand Up @@ -140,6 +140,10 @@ def handle_special
end
end

add_special :debugger do
fragment 'debugger'
end

class DependencyResolver
def initialize(compiler, sexp)
@compiler = compiler
Expand Down
7 changes: 7 additions & 0 deletions spec/cli/compiler_spec.rb
Expand Up @@ -31,6 +31,13 @@
end
end

describe "debugger special method" do
it "generates debugger keyword in javascript" do
expect_compiled("debugger").to include("debugger")
expect_compiled("debugger").to_not include("$debugger")
end
end

def expect_compiled(source)
expect(Opal::Compiler.new.compile source)
end
Expand Down

0 comments on commit b10658b

Please sign in to comment.