esfuzz
Version:
JS fuzzer for generative testing of parsers that implement the SpiderMonkey Reflect.parse API
58 lines (57 loc) • 1.64 kB
JavaScript
// Generated by CoffeeScript 2.0.0-beta7
void function () {
var AssignmentExpression, construct, Expression, Identifier, LHSExpression, Node, OPERATORS, randomElement;
Node = require('../node');
Expression = require('../classes/Expression');
LHSExpression = require('../classes/LHSExpression');
Identifier = require('./Identifier');
construct = require('../combinators').construct;
randomElement = require('../random').randomElement;
OPERATORS = [
'=',
'+=',
'-=',
'*=',
'/=',
'%=',
'<<=',
'>>=',
'>>>=',
'|=',
'^=',
'&='
];
AssignmentExpression = function (super$) {
extends$(AssignmentExpression, super$);
AssignmentExpression.prototype.type = AssignmentExpression.name;
function AssignmentExpression(depth, ancestors) {
--depth;
this.operator = randomElement(OPERATORS);
if (depth > 0) {
ancestors = [this].concat(ancestors);
this.left = LHSExpression(depth, ancestors);
this.right = Expression(depth, ancestors);
} else {
this.left = Identifier(0);
this.right = Expression(0);
}
}
return AssignmentExpression;
}(Node);
module.exports = construct(AssignmentExpression);
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);