Ver código fonte

Add DebuggerStatement to compiler.compileStatement

Currently, `goja` panics when trying to compile a `debugger` statement.  According to the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-debugger-statement), a `debugger` statement is a no-op if no debugging facilities are present.  This PR adds an empty `case` statement for `*ast.DebuggerStatement` in `compiler.compileStatement` so that `debugger` statements become no-ops rather than causing the compiler to panic.

Fixes #3
Niels Widger 9 anos atrás
pai
commit
d3092335fb
1 arquivos alterados com 1 adições e 0 exclusões
  1. 1 0
      compiler_stmt.go

+ 1 - 0
compiler_stmt.go

@@ -49,6 +49,7 @@ func (c *compiler) compileStatement(v ast.Statement, needResult bool) {
 		}
 	case *ast.WithStatement:
 		c.compileWithStatement(v, needResult)
+	case *ast.DebuggerStatement:
 	default:
 		panic(fmt.Errorf("Unknown statement type: %T", v))
 	}