esfuzz
Version:
JS fuzzer for generative testing of parsers that implement the SpiderMonkey Reflect.parse API
61 lines (60 loc) • 1.91 kB
JavaScript
// Generated by CoffeeScript 2.0.0-beta7
void function () {
var construct, Identifier, LabeledStatement, labelNames, Node, Statement;
Node = require('../node');
Statement = require('../classes/Statement');
Identifier = require('./Identifier');
construct = require('../combinators').construct;
labelNames = function (ancestors) {
var accum, ancestor;
accum = [];
for (var i$ = 0, length$ = ancestors.length; i$ < length$; ++i$) {
ancestor = ancestors[i$];
if (ancestor.type === 'FunctionDeclaration') {
break;
} else if (ancestor.type === 'LabeledStatement') {
accum.push(ancestor.label.name);
}
}
return accum;
};
LabeledStatement = function (super$) {
extends$(LabeledStatement, super$);
LabeledStatement.prototype.type = LabeledStatement.name;
function LabeledStatement(depth, ancestors) {
var ancestorLabelNames, id;
--depth;
ancestorLabelNames = labelNames(ancestors);
ancestors = [this].concat(ancestors);
id = null;
while (!(null != id && !in$(id.name, ancestorLabelNames))) {
id = Identifier(depth, ancestors);
}
this.label = id;
this.body = Statement(depth, ancestors);
}
return LabeledStatement;
}(Node);
module.exports = construct(LabeledStatement);
function in$(member, list) {
for (var i = 0, length = list.length; i < length; ++i)
if (i in list && list[i] === member)
return true;
return false;
}
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);