UNPKG

esfuzz

Version:

JS fuzzer for generative testing of parsers that implement the SpiderMonkey Reflect.parse API

58 lines (57 loc) 2 kB
// Generated by CoffeeScript 2.0.0-beta7 void function () { var BlockStatement, cache$, CatchClause, construct, Identifier, maybe, Node, Pattern, randomBool, TryStatement; Node = require('../node'); Pattern = require('../classes/Pattern'); BlockStatement = require('./BlockStatement'); Identifier = require('./Identifier'); cache$ = require('../combinators'); construct = cache$.construct; maybe = cache$.maybe; randomBool = require('../random').randomBool; CatchClause = function (super$) { extends$(CatchClause, super$); CatchClause.prototype.type = 'CatchClause'; CatchClause.prototype.guard = null; function CatchClause(depth, ancestors) { ancestors = [this].concat(ancestors); this.param = Pattern(depth, ancestors); this.body = BlockStatement(depth, ancestors); } return CatchClause; }(Node); TryStatement = function (super$) { extends$(TryStatement, super$); TryStatement.prototype.type = TryStatement.name; TryStatement.prototype.guardedHandlers = []; function TryStatement(depth, ancestors) { --depth; ancestors = [this].concat(ancestors); this.block = BlockStatement(depth, ancestors); if (randomBool()) { this.handler = maybe(construct(CatchClause))(depth, ancestors); this.finalizer = BlockStatement(depth, ancestors); } else { this.handler = construct(CatchClause)(depth, ancestors); this.finalizer = maybe(BlockStatement)(depth, ancestors); } } return TryStatement; }(Node); module.exports = construct(TryStatement); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } function extends$(child, parent) { for (var key in parent) if (isOwn$(parent, key)) child[key] = parent[key]; function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; } }.call(this);