esfuzz
Version:
JS fuzzer for generative testing of parsers that implement the SpiderMonkey Reflect.parse API
71 lines (70 loc) • 2.44 kB
JavaScript
// Generated by CoffeeScript 2.0.0-beta7
void function () {
var cache$, construct, Expression, listOf, listOfAtLeast, Node, oneOf, Statement, SwitchCase, SwitchCaseDefault, SwitchStatement;
Node = require('../node');
Statement = require('../classes/Statement');
Expression = require('../classes/Expression');
cache$ = require('../combinators');
construct = cache$.construct;
oneOf = cache$.oneOf;
listOf = cache$.listOf;
listOfAtLeast = cache$.listOfAtLeast;
SwitchCase = function (super$) {
extends$(SwitchCase, super$);
SwitchCase.prototype.type = 'SwitchCase';
function SwitchCase(depth, ancestors) {
ancestors = [this].concat(ancestors);
this.test = Expression(depth, ancestors);
this.consequent = listOfAtLeast(1, [Statement])(depth, ancestors);
}
return SwitchCase;
}(Node);
SwitchCaseDefault = function (super$) {
extends$(SwitchCaseDefault, super$);
SwitchCaseDefault.prototype.type = 'SwitchCase';
SwitchCaseDefault.prototype.test = null;
function SwitchCaseDefault(depth, ancestors) {
ancestors = [this].concat(ancestors);
this.consequent = listOfAtLeast(1, [Statement])(depth, ancestors);
}
return SwitchCaseDefault;
}(Node);
SwitchStatement = function (super$) {
extends$(SwitchStatement, super$);
SwitchStatement.prototype.type = SwitchStatement.name;
SwitchStatement.prototype.cases = [];
SwitchStatement.prototype.lexical = false;
function SwitchStatement(depth, ancestors) {
--depth;
if (depth > 0) {
ancestors = [this].concat(ancestors);
this.discriminant = Expression(depth, ancestors);
this.cases = listOf([construct(SwitchCase)])(depth, ancestors).concat(oneOf([
construct(SwitchCaseDefault),
function () {
return [];
}
])(depth, ancestors));
} else {
this.discriminant = Expression(0);
}
}
return SwitchStatement;
}(Node);
module.exports = construct(SwitchStatement);
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);