decaffeinate-parser
Version:
A better AST for CoffeeScript, inspired by CoffeeScriptRedux.
1,319 lines • 57.1 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Node = /** @class */ (function () {
function Node(type, line, column, start, end, raw) {
this.type = type;
this.line = line;
this.column = column;
this.start = start;
this.end = end;
this.raw = raw;
this.parentNode = null;
}
Node.prototype.getChildren = function () {
var children = [];
for (var _i = 0, _a = this.getChildFields(); _i < _a.length; _i++) {
var childField = _a[_i];
if (Array.isArray(childField)) {
children.push.apply(children, childField.filter(function (node) { return node !== null; }));
}
else if (childField) {
children.push(childField);
}
}
return children;
};
Node.prototype.getChildFields = function () {
var _this = this;
return this.getChildNames().map(function (name) { return _this[name]; });
};
return Node;
}());
export { Node };
var Identifier = /** @class */ (function (_super) {
__extends(Identifier, _super);
function Identifier(line, column, start, end, raw, data) {
var _this = _super.call(this, 'Identifier', line, column, start, end, raw) || this;
_this.data = data;
return _this;
}
Identifier.prototype.getChildNames = function () {
return [];
};
return Identifier;
}(Node));
export { Identifier };
var Bool = /** @class */ (function (_super) {
__extends(Bool, _super);
function Bool(line, column, start, end, raw, data) {
var _this = _super.call(this, 'Bool', line, column, start, end, raw) || this;
_this.data = data;
return _this;
}
Bool["true"] = function () {
return new Bool(0, 0, 0, 0, '', true);
};
Bool["false"] = function () {
return new Bool(0, 0, 0, 0, '', false);
};
Bool.prototype.getChildNames = function () {
return [];
};
return Bool;
}(Node));
export { Bool };
var JavaScript = /** @class */ (function (_super) {
__extends(JavaScript, _super);
function JavaScript(line, column, start, end, raw, data) {
var _this = _super.call(this, 'JavaScript', line, column, start, end, raw) || this;
_this.data = data;
return _this;
}
JavaScript.prototype.getChildNames = function () {
return [];
};
return JavaScript;
}(Node));
export { JavaScript };
var Number = /** @class */ (function (_super) {
__extends(Number, _super);
function Number(type, line, column, start, end, raw, data) {
var _this = _super.call(this, type, line, column, start, end, raw) || this;
_this.data = data;
return _this;
}
Number.prototype.getChildNames = function () {
return [];
};
return Number;
}(Node));
export { Number };
var Float = /** @class */ (function (_super) {
__extends(Float, _super);
function Float(line, column, start, end, raw, data) {
return _super.call(this, 'Float', line, column, start, end, raw, data) || this;
}
return Float;
}(Number));
export { Float };
var Int = /** @class */ (function (_super) {
__extends(Int, _super);
function Int(line, column, start, end, raw, data) {
return _super.call(this, 'Int', line, column, start, end, raw, data) || this;
}
return Int;
}(Number));
export { Int };
var AccessOp = /** @class */ (function (_super) {
__extends(AccessOp, _super);
function AccessOp(type, line, column, start, end, raw, expression) {
var _this = _super.call(this, type, line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
return AccessOp;
}(Node));
export { AccessOp };
var MemberAccessOp = /** @class */ (function (_super) {
__extends(MemberAccessOp, _super);
function MemberAccessOp(line, column, start, end, raw, expression, member) {
var _this = _super.call(this, 'MemberAccessOp', line, column, start, end, raw, expression) || this;
_this.member = member;
return _this;
}
MemberAccessOp.prototype.getChildNames = function () {
return ['expression', 'member'];
};
return MemberAccessOp;
}(AccessOp));
export { MemberAccessOp };
var ProtoMemberAccessOp = /** @class */ (function (_super) {
__extends(ProtoMemberAccessOp, _super);
function ProtoMemberAccessOp(line, column, start, end, raw, expression) {
return _super.call(this, 'ProtoMemberAccessOp', line, column, start, end, raw, expression) || this;
}
ProtoMemberAccessOp.prototype.getChildNames = function () {
return ['expression'];
};
return ProtoMemberAccessOp;
}(AccessOp));
export { ProtoMemberAccessOp };
var SoakedMemberAccessOp = /** @class */ (function (_super) {
__extends(SoakedMemberAccessOp, _super);
function SoakedMemberAccessOp(line, column, start, end, raw, expression, member) {
var _this = _super.call(this, 'SoakedMemberAccessOp', line, column, start, end, raw, expression) || this;
_this.member = member;
return _this;
}
SoakedMemberAccessOp.prototype.getChildNames = function () {
return ['expression', 'member'];
};
return SoakedMemberAccessOp;
}(AccessOp));
export { SoakedMemberAccessOp };
var SoakedProtoMemberAccessOp = /** @class */ (function (_super) {
__extends(SoakedProtoMemberAccessOp, _super);
function SoakedProtoMemberAccessOp(line, column, start, end, raw, expression) {
return _super.call(this, 'SoakedProtoMemberAccessOp', line, column, start, end, raw, expression) || this;
}
SoakedProtoMemberAccessOp.prototype.getChildNames = function () {
return ['expression'];
};
return SoakedProtoMemberAccessOp;
}(AccessOp));
export { SoakedProtoMemberAccessOp };
var DynamicMemberAccessOp = /** @class */ (function (_super) {
__extends(DynamicMemberAccessOp, _super);
function DynamicMemberAccessOp(line, column, start, end, raw, expression, indexingExpr) {
var _this = _super.call(this, 'DynamicMemberAccessOp', line, column, start, end, raw, expression) || this;
_this.indexingExpr = indexingExpr;
return _this;
}
DynamicMemberAccessOp.prototype.getChildNames = function () {
return ['expression', 'indexingExpr'];
};
return DynamicMemberAccessOp;
}(AccessOp));
export { DynamicMemberAccessOp };
var SoakedDynamicMemberAccessOp = /** @class */ (function (_super) {
__extends(SoakedDynamicMemberAccessOp, _super);
function SoakedDynamicMemberAccessOp(line, column, start, end, raw, expression, indexingExpr) {
var _this = _super.call(this, 'SoakedDynamicMemberAccessOp', line, column, start, end, raw, expression) || this;
_this.indexingExpr = indexingExpr;
return _this;
}
SoakedDynamicMemberAccessOp.prototype.getChildNames = function () {
return ['expression', 'indexingExpr'];
};
return SoakedDynamicMemberAccessOp;
}(AccessOp));
export { SoakedDynamicMemberAccessOp };
var Quasi = /** @class */ (function (_super) {
__extends(Quasi, _super);
function Quasi(line, column, start, end, raw, data) {
var _this = _super.call(this, 'Quasi', line, column, start, end, raw) || this;
_this.data = data;
return _this;
}
Quasi.prototype.getChildNames = function () {
return [];
};
return Quasi;
}(Node));
export { Quasi };
var String = /** @class */ (function (_super) {
__extends(String, _super);
function String(line, column, start, end, raw, quasis, expressions) {
var _this = _super.call(this, 'String', line, column, start, end, raw) || this;
_this.quasis = quasis;
_this.expressions = expressions;
return _this;
}
String.prototype.getChildNames = function () {
return ['quasis', 'expressions'];
};
return String;
}(Node));
export { String };
var TaggedTemplateLiteral = /** @class */ (function (_super) {
__extends(TaggedTemplateLiteral, _super);
function TaggedTemplateLiteral(line, column, start, end, raw, tag,
// eslint-disable-next-line @typescript-eslint/ban-types
template) {
var _this = _super.call(this, 'TaggedTemplateLiteral', line, column, start, end, raw) || this;
_this.tag = tag;
_this.template = template;
return _this;
}
TaggedTemplateLiteral.prototype.getChildNames = function () {
return ['tag', 'template'];
};
return TaggedTemplateLiteral;
}(Node));
export { TaggedTemplateLiteral };
var ObjectInitialiser = /** @class */ (function (_super) {
__extends(ObjectInitialiser, _super);
function ObjectInitialiser(line, column, start, end, raw, members) {
var _this = _super.call(this, 'ObjectInitialiser', line, column, start, end, raw) || this;
_this.members = members;
return _this;
}
ObjectInitialiser.prototype.getChildNames = function () {
return ['members'];
};
return ObjectInitialiser;
}(Node));
export { ObjectInitialiser };
var ObjectInitialiserMember = /** @class */ (function (_super) {
__extends(ObjectInitialiserMember, _super);
function ObjectInitialiserMember(line, column, start, end, raw, key,
// If null, this is a shorthand initializer and the key and value are the same.
expression, isComputed) {
var _this = _super.call(this, 'ObjectInitialiserMember', line, column, start, end, raw) || this;
_this.key = key;
_this.expression = expression;
_this.isComputed = isComputed;
return _this;
}
ObjectInitialiserMember.prototype.getChildNames = function () {
return ['key', 'expression'];
};
return ObjectInitialiserMember;
}(Node));
export { ObjectInitialiserMember };
var Conditional = /** @class */ (function (_super) {
__extends(Conditional, _super);
function Conditional(line, column, start, end, raw, condition, consequent, alternate, isUnless) {
var _this = _super.call(this, 'Conditional', line, column, start, end, raw) || this;
_this.condition = condition;
_this.consequent = consequent;
_this.alternate = alternate;
_this.isUnless = isUnless;
return _this;
}
Conditional.prototype.getChildNames = function () {
return ['condition', 'consequent', 'alternate'];
};
return Conditional;
}(Node));
export { Conditional };
var Program = /** @class */ (function (_super) {
__extends(Program, _super);
function Program(line, column, start, end, raw, body, context) {
var _this = _super.call(this, 'Program', line, column, start, end, raw) || this;
_this.body = body;
_this.context = context;
return _this;
}
Program.prototype.getChildNames = function () {
return ['body'];
};
return Program;
}(Node));
export { Program };
var Block = /** @class */ (function (_super) {
__extends(Block, _super);
function Block(line, column, start, end, raw, statements, inline) {
var _this = _super.call(this, 'Block', line, column, start, end, raw) || this;
_this.statements = statements;
_this.inline = inline;
return _this;
}
Block.prototype.getChildNames = function () {
return ['statements'];
};
Block.prototype.withInline = function (inline) {
return new Block(this.line, this.column, this.start, this.end, this.raw, this.statements, inline);
};
return Block;
}(Node));
export { Block };
var Loop = /** @class */ (function (_super) {
__extends(Loop, _super);
function Loop(line, column, start, end, raw, body) {
var _this = _super.call(this, 'Loop', line, column, start, end, raw) || this;
_this.body = body;
return _this;
}
Loop.prototype.getChildNames = function () {
return ['body'];
};
return Loop;
}(Node));
export { Loop };
var While = /** @class */ (function (_super) {
__extends(While, _super);
function While(line, column, start, end, raw, condition, guard, body, isUntil) {
var _this = _super.call(this, 'While', line, column, start, end, raw) || this;
_this.condition = condition;
_this.guard = guard;
_this.body = body;
_this.isUntil = isUntil;
return _this;
}
While.prototype.getChildNames = function () {
return ['condition', 'guard', 'body'];
};
return While;
}(Node));
export { While };
var For = /** @class */ (function (_super) {
__extends(For, _super);
function For(type, line, column, start, end, raw, keyAssignee, valAssignee, target, filter, body) {
var _this = _super.call(this, type, line, column, start, end, raw) || this;
_this.keyAssignee = keyAssignee;
_this.valAssignee = valAssignee;
_this.target = target;
_this.filter = filter;
_this.body = body;
return _this;
}
return For;
}(Node));
export { For };
var ForOf = /** @class */ (function (_super) {
__extends(ForOf, _super);
function ForOf(line, column, start, end, raw, keyAssignee, valAssignee, target, filter, body, isOwn) {
var _this = _super.call(this, 'ForOf', line, column, start, end, raw, keyAssignee, valAssignee, target, filter, body) || this;
_this.isOwn = isOwn;
return _this;
}
ForOf.prototype.getChildNames = function () {
return ['keyAssignee', 'valAssignee', 'target', 'filter', 'body'];
};
return ForOf;
}(For));
export { ForOf };
var ForIn = /** @class */ (function (_super) {
__extends(ForIn, _super);
function ForIn(line, column, start, end, raw, keyAssignee, valAssignee, target, filter, body, step) {
var _this = _super.call(this, 'ForIn', line, column, start, end, raw, keyAssignee, valAssignee, target, filter, body) || this;
_this.step = step;
return _this;
}
ForIn.prototype.getChildNames = function () {
return ['keyAssignee', 'valAssignee', 'target', 'step', 'filter', 'body'];
};
return ForIn;
}(For));
export { ForIn };
var ForFrom = /** @class */ (function (_super) {
__extends(ForFrom, _super);
function ForFrom(line, column, start, end, raw, valAssignee, target, filter, body) {
return _super.call(this, 'ForFrom', line, column, start, end, raw, null /* keyAssignee */, valAssignee, target, filter, body) || this;
}
ForFrom.prototype.getChildNames = function () {
return ['keyAssignee', 'valAssignee', 'target', 'filter', 'body'];
};
return ForFrom;
}(For));
export { ForFrom };
var Switch = /** @class */ (function (_super) {
__extends(Switch, _super);
function Switch(line, column, start, end, raw, expression, cases, alternate) {
var _this = _super.call(this, 'Switch', line, column, start, end, raw) || this;
_this.expression = expression;
_this.cases = cases;
_this.alternate = alternate;
return _this;
}
Switch.prototype.getChildNames = function () {
return ['expression', 'cases', 'alternate'];
};
return Switch;
}(Node));
export { Switch };
var SwitchCase = /** @class */ (function (_super) {
__extends(SwitchCase, _super);
function SwitchCase(line, column, start, end, raw, conditions, consequent) {
var _this = _super.call(this, 'SwitchCase', line, column, start, end, raw) || this;
_this.conditions = conditions;
_this.consequent = consequent;
return _this;
}
SwitchCase.prototype.getChildNames = function () {
return ['conditions', 'consequent'];
};
return SwitchCase;
}(Node));
export { SwitchCase };
var RegexFlags = /** @class */ (function () {
function RegexFlags(global, ignoreCase, multiline, unicode, sticky) {
this.global = global;
this.ignoreCase = ignoreCase;
this.multiline = multiline;
this.unicode = unicode;
this.sticky = sticky;
this.g = global;
this.i = ignoreCase;
this.m = multiline;
this.u = unicode;
this.y = sticky;
}
RegexFlags.parse = function (flags) {
var global = false;
var ignoreCase = false;
var multiline = false;
var unicode = false;
var sticky = false;
for (var i = 0; i < flags.length; i++) {
switch (flags.charCodeAt(i)) {
case 103:
global = true;
break;
case 105:
ignoreCase = true;
break;
case 109:
multiline = true;
break;
case 117:
unicode = true;
break;
case 121:
sticky = true;
break;
default:
throw new Error("invalid regular expression flags: " + flags);
}
}
return new RegexFlags(global, ignoreCase, multiline, unicode, sticky);
};
return RegexFlags;
}());
export { RegexFlags };
var Heregex = /** @class */ (function (_super) {
__extends(Heregex, _super);
function Heregex(line, column, start, end, raw, quasis, expressions, flags) {
var _this = _super.call(this, 'Heregex', line, column, start, end, raw) || this;
_this.quasis = quasis;
_this.expressions = expressions;
_this.flags = flags;
return _this;
}
Heregex.prototype.getChildNames = function () {
return ['quasis', 'expressions'];
};
return Heregex;
}(Node));
export { Heregex };
var Null = /** @class */ (function (_super) {
__extends(Null, _super);
function Null(line, column, start, end, raw) {
return _super.call(this, 'Null', line, column, start, end, raw) || this;
}
Null.prototype.getChildNames = function () {
return [];
};
return Null;
}(Node));
export { Null };
var Undefined = /** @class */ (function (_super) {
__extends(Undefined, _super);
function Undefined(line, column, start, end, raw) {
return _super.call(this, 'Undefined', line, column, start, end, raw) || this;
}
Undefined.prototype.getChildNames = function () {
return [];
};
return Undefined;
}(Node));
export { Undefined };
var Regex = /** @class */ (function (_super) {
__extends(Regex, _super);
function Regex(line, column, start, end, raw, pattern, flags) {
var _this = _super.call(this, 'Regex', line, column, start, end, raw) || this;
_this.pattern = pattern;
_this.flags = flags;
return _this;
}
Regex.prototype.getChildNames = function () {
return [];
};
return Regex;
}(Node));
export { Regex };
var Return = /** @class */ (function (_super) {
__extends(Return, _super);
function Return(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'Return', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
Return.prototype.getChildNames = function () {
return ['expression'];
};
return Return;
}(Node));
export { Return };
var YieldReturn = /** @class */ (function (_super) {
__extends(YieldReturn, _super);
function YieldReturn(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'YieldReturn', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
YieldReturn.prototype.getChildNames = function () {
return ['expression'];
};
return YieldReturn;
}(Node));
export { YieldReturn };
var AwaitReturn = /** @class */ (function (_super) {
__extends(AwaitReturn, _super);
function AwaitReturn(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'AwaitReturn', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
AwaitReturn.prototype.getChildNames = function () {
return ['expression'];
};
return AwaitReturn;
}(Node));
export { AwaitReturn };
var This = /** @class */ (function (_super) {
__extends(This, _super);
function This(line, column, start, end, raw) {
return _super.call(this, 'This', line, column, start, end, raw) || this;
}
This.prototype.getChildNames = function () {
return [];
};
return This;
}(Node));
export { This };
var Throw = /** @class */ (function (_super) {
__extends(Throw, _super);
function Throw(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'Throw', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
Throw.prototype.getChildNames = function () {
return ['expression'];
};
return Throw;
}(Node));
export { Throw };
var ArrayInitialiser = /** @class */ (function (_super) {
__extends(ArrayInitialiser, _super);
function ArrayInitialiser(line, column, start, end, raw, members) {
var _this = _super.call(this, 'ArrayInitialiser', line, column, start, end, raw) || this;
_this.members = members;
return _this;
}
ArrayInitialiser.prototype.getChildNames = function () {
return ['members'];
};
return ArrayInitialiser;
}(Node));
export { ArrayInitialiser };
var DefaultParam = /** @class */ (function (_super) {
__extends(DefaultParam, _super);
function DefaultParam(line, column, start, end, raw, param, defaultValue) {
var _this = _super.call(this, 'DefaultParam', line, column, start, end, raw) || this;
_this.param = param;
_this["default"] = defaultValue;
return _this;
}
DefaultParam.prototype.getChildNames = function () {
return ['param', 'default'];
};
return DefaultParam;
}(Node));
export { DefaultParam };
var Rest = /** @class */ (function (_super) {
__extends(Rest, _super);
function Rest(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'Rest', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
Rest.prototype.getChildNames = function () {
return ['expression'];
};
return Rest;
}(Node));
export { Rest };
var Expansion = /** @class */ (function (_super) {
__extends(Expansion, _super);
function Expansion(line, column, start, end, raw) {
return _super.call(this, 'Expansion', line, column, start, end, raw) || this;
}
Expansion.prototype.getChildNames = function () {
return [];
};
return Expansion;
}(Node));
export { Expansion };
var Elision = /** @class */ (function (_super) {
__extends(Elision, _super);
function Elision(line, column, start, end, raw) {
return _super.call(this, 'Elision', line, column, start, end, raw) || this;
}
Elision.prototype.getChildNames = function () {
return [];
};
return Elision;
}(Node));
export { Elision };
var Break = /** @class */ (function (_super) {
__extends(Break, _super);
function Break(line, column, start, end, raw) {
return _super.call(this, 'Break', line, column, start, end, raw) || this;
}
Break.prototype.getChildNames = function () {
return [];
};
return Break;
}(Node));
export { Break };
var Continue = /** @class */ (function (_super) {
__extends(Continue, _super);
function Continue(line, column, start, end, raw) {
return _super.call(this, 'Continue', line, column, start, end, raw) || this;
}
Continue.prototype.getChildNames = function () {
return [];
};
return Continue;
}(Node));
export { Continue };
var Spread = /** @class */ (function (_super) {
__extends(Spread, _super);
function Spread(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'Spread', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
Spread.prototype.getChildNames = function () {
return ['expression'];
};
return Spread;
}(Node));
export { Spread };
var Range = /** @class */ (function (_super) {
__extends(Range, _super);
function Range(line, column, start, end, raw, left, right, isInclusive) {
var _this = _super.call(this, 'Range', line, column, start, end, raw) || this;
_this.left = left;
_this.right = right;
_this.isInclusive = isInclusive;
return _this;
}
Range.prototype.getChildNames = function () {
return ['left', 'right'];
};
return Range;
}(Node));
export { Range };
var BinaryOp = /** @class */ (function (_super) {
__extends(BinaryOp, _super);
function BinaryOp(type, line, column, start, end, raw, left, right) {
var _this = _super.call(this, type, line, column, start, end, raw) || this;
_this.left = left;
_this.right = right;
return _this;
}
BinaryOp.prototype.getChildNames = function () {
return ['left', 'right'];
};
return BinaryOp;
}(Node));
export { BinaryOp };
var UnaryOp = /** @class */ (function (_super) {
__extends(UnaryOp, _super);
function UnaryOp(type, line, column, start, end, raw, expression) {
var _this = _super.call(this, type, line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
UnaryOp.prototype.getChildNames = function () {
return ['expression'];
};
return UnaryOp;
}(Node));
export { UnaryOp };
var ChainedComparisonOp = /** @class */ (function (_super) {
__extends(ChainedComparisonOp, _super);
function ChainedComparisonOp(line, column, start, end, raw, operands, operators) {
var _this = _super.call(this, 'ChainedComparisonOp', line, column, start, end, raw) || this;
_this.operands = operands;
_this.operators = operators;
return _this;
}
ChainedComparisonOp.prototype.getChildNames = function () {
return ['operands'];
};
return ChainedComparisonOp;
}(Node));
export { ChainedComparisonOp };
var OperatorInfo = /** @class */ (function () {
function OperatorInfo(operator, token) {
this.operator = operator;
this.token = token;
}
return OperatorInfo;
}());
export { OperatorInfo };
var EQOp = /** @class */ (function (_super) {
__extends(EQOp, _super);
function EQOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'EQOp', line, column, start, end, raw, left, right) || this;
}
return EQOp;
}(BinaryOp));
export { EQOp };
var NEQOp = /** @class */ (function (_super) {
__extends(NEQOp, _super);
function NEQOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'NEQOp', line, column, start, end, raw, left, right) || this;
}
return NEQOp;
}(BinaryOp));
export { NEQOp };
var LTOp = /** @class */ (function (_super) {
__extends(LTOp, _super);
function LTOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'LTOp', line, column, start, end, raw, left, right) || this;
}
return LTOp;
}(BinaryOp));
export { LTOp };
var LTEOp = /** @class */ (function (_super) {
__extends(LTEOp, _super);
function LTEOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'LTEOp', line, column, start, end, raw, left, right) || this;
}
return LTEOp;
}(BinaryOp));
export { LTEOp };
var GTOp = /** @class */ (function (_super) {
__extends(GTOp, _super);
function GTOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'GTOp', line, column, start, end, raw, left, right) || this;
}
return GTOp;
}(BinaryOp));
export { GTOp };
var GTEOp = /** @class */ (function (_super) {
__extends(GTEOp, _super);
function GTEOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'GTEOp', line, column, start, end, raw, left, right) || this;
}
return GTEOp;
}(BinaryOp));
export { GTEOp };
var LogicalNotOp = /** @class */ (function (_super) {
__extends(LogicalNotOp, _super);
function LogicalNotOp(line, column, start, end, raw, expression) {
return _super.call(this, 'LogicalNotOp', line, column, start, end, raw, expression) || this;
}
return LogicalNotOp;
}(UnaryOp));
export { LogicalNotOp };
var LogicalAndOp = /** @class */ (function (_super) {
__extends(LogicalAndOp, _super);
function LogicalAndOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'LogicalAndOp', line, column, start, end, raw, left, right) || this;
}
return LogicalAndOp;
}(BinaryOp));
export { LogicalAndOp };
var LogicalOrOp = /** @class */ (function (_super) {
__extends(LogicalOrOp, _super);
function LogicalOrOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'LogicalOrOp', line, column, start, end, raw, left, right) || this;
}
return LogicalOrOp;
}(BinaryOp));
export { LogicalOrOp };
var SubtractOp = /** @class */ (function (_super) {
__extends(SubtractOp, _super);
function SubtractOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'SubtractOp', line, column, start, end, raw, left, right) || this;
}
return SubtractOp;
}(BinaryOp));
export { SubtractOp };
var PlusOp = /** @class */ (function (_super) {
__extends(PlusOp, _super);
function PlusOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'PlusOp', line, column, start, end, raw, left, right) || this;
}
return PlusOp;
}(BinaryOp));
export { PlusOp };
var UnaryPlusOp = /** @class */ (function (_super) {
__extends(UnaryPlusOp, _super);
function UnaryPlusOp(line, column, start, end, raw, expression) {
return _super.call(this, 'UnaryPlusOp', line, column, start, end, raw, expression) || this;
}
return UnaryPlusOp;
}(UnaryOp));
export { UnaryPlusOp };
var MultiplyOp = /** @class */ (function (_super) {
__extends(MultiplyOp, _super);
function MultiplyOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'MultiplyOp', line, column, start, end, raw, left, right) || this;
}
return MultiplyOp;
}(BinaryOp));
export { MultiplyOp };
var DivideOp = /** @class */ (function (_super) {
__extends(DivideOp, _super);
function DivideOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'DivideOp', line, column, start, end, raw, left, right) || this;
}
return DivideOp;
}(BinaryOp));
export { DivideOp };
var FloorDivideOp = /** @class */ (function (_super) {
__extends(FloorDivideOp, _super);
function FloorDivideOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'FloorDivideOp', line, column, start, end, raw, left, right) || this;
}
return FloorDivideOp;
}(BinaryOp));
export { FloorDivideOp };
var ExistsOp = /** @class */ (function (_super) {
__extends(ExistsOp, _super);
function ExistsOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'ExistsOp', line, column, start, end, raw, left, right) || this;
}
return ExistsOp;
}(BinaryOp));
export { ExistsOp };
var UnaryExistsOp = /** @class */ (function (_super) {
__extends(UnaryExistsOp, _super);
function UnaryExistsOp(line, column, start, end, raw, expression) {
return _super.call(this, 'UnaryExistsOp', line, column, start, end, raw, expression) || this;
}
return UnaryExistsOp;
}(UnaryOp));
export { UnaryExistsOp };
var UnaryNegateOp = /** @class */ (function (_super) {
__extends(UnaryNegateOp, _super);
function UnaryNegateOp(line, column, start, end, raw, expression) {
return _super.call(this, 'UnaryNegateOp', line, column, start, end, raw, expression) || this;
}
return UnaryNegateOp;
}(UnaryOp));
export { UnaryNegateOp };
var BitNotOp = /** @class */ (function (_super) {
__extends(BitNotOp, _super);
function BitNotOp(line, column, start, end, raw, expression) {
return _super.call(this, 'BitNotOp', line, column, start, end, raw, expression) || this;
}
return BitNotOp;
}(UnaryOp));
export { BitNotOp };
var BitAndOp = /** @class */ (function (_super) {
__extends(BitAndOp, _super);
function BitAndOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'BitAndOp', line, column, start, end, raw, left, right) || this;
}
return BitAndOp;
}(BinaryOp));
export { BitAndOp };
var BitOrOp = /** @class */ (function (_super) {
__extends(BitOrOp, _super);
function BitOrOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'BitOrOp', line, column, start, end, raw, left, right) || this;
}
return BitOrOp;
}(BinaryOp));
export { BitOrOp };
var BitXorOp = /** @class */ (function (_super) {
__extends(BitXorOp, _super);
function BitXorOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'BitXorOp', line, column, start, end, raw, left, right) || this;
}
return BitXorOp;
}(BinaryOp));
export { BitXorOp };
var LeftShiftOp = /** @class */ (function (_super) {
__extends(LeftShiftOp, _super);
function LeftShiftOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'LeftShiftOp', line, column, start, end, raw, left, right) || this;
}
return LeftShiftOp;
}(BinaryOp));
export { LeftShiftOp };
var SignedRightShiftOp = /** @class */ (function (_super) {
__extends(SignedRightShiftOp, _super);
function SignedRightShiftOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'SignedRightShiftOp', line, column, start, end, raw, left, right) || this;
}
return SignedRightShiftOp;
}(BinaryOp));
export { SignedRightShiftOp };
var UnsignedRightShiftOp = /** @class */ (function (_super) {
__extends(UnsignedRightShiftOp, _super);
function UnsignedRightShiftOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'UnsignedRightShiftOp', line, column, start, end, raw, left, right) || this;
}
return UnsignedRightShiftOp;
}(BinaryOp));
export { UnsignedRightShiftOp };
var PreDecrementOp = /** @class */ (function (_super) {
__extends(PreDecrementOp, _super);
function PreDecrementOp(line, column, start, end, raw, expression) {
return _super.call(this, 'PreDecrementOp', line, column, start, end, raw, expression) || this;
}
return PreDecrementOp;
}(UnaryOp));
export { PreDecrementOp };
var PreIncrementOp = /** @class */ (function (_super) {
__extends(PreIncrementOp, _super);
function PreIncrementOp(line, column, start, end, raw, expression) {
return _super.call(this, 'PreIncrementOp', line, column, start, end, raw, expression) || this;
}
return PreIncrementOp;
}(UnaryOp));
export { PreIncrementOp };
var PostDecrementOp = /** @class */ (function (_super) {
__extends(PostDecrementOp, _super);
function PostDecrementOp(line, column, start, end, raw, expression) {
return _super.call(this, 'PostDecrementOp', line, column, start, end, raw, expression) || this;
}
return PostDecrementOp;
}(UnaryOp));
export { PostDecrementOp };
var PostIncrementOp = /** @class */ (function (_super) {
__extends(PostIncrementOp, _super);
function PostIncrementOp(line, column, start, end, raw, expression) {
return _super.call(this, 'PostIncrementOp', line, column, start, end, raw, expression) || this;
}
return PostIncrementOp;
}(UnaryOp));
export { PostIncrementOp };
var ExpOp = /** @class */ (function (_super) {
__extends(ExpOp, _super);
function ExpOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'ExpOp', line, column, start, end, raw, left, right) || this;
}
return ExpOp;
}(BinaryOp));
export { ExpOp };
var RemOp = /** @class */ (function (_super) {
__extends(RemOp, _super);
function RemOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'RemOp', line, column, start, end, raw, left, right) || this;
}
return RemOp;
}(BinaryOp));
export { RemOp };
var ModuloOp = /** @class */ (function (_super) {
__extends(ModuloOp, _super);
function ModuloOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'ModuloOp', line, column, start, end, raw, left, right) || this;
}
return ModuloOp;
}(BinaryOp));
export { ModuloOp };
var InOp = /** @class */ (function (_super) {
__extends(InOp, _super);
function InOp(line, column, start, end, raw, left, right, isNot) {
var _this = _super.call(this, 'InOp', line, column, start, end, raw, left, right) || this;
_this.isNot = isNot;
return _this;
}
return InOp;
}(BinaryOp));
export { InOp };
var BaseAssignOp = /** @class */ (function (_super) {
__extends(BaseAssignOp, _super);
function BaseAssignOp(type, line, column, start, end, raw, assignee, expression) {
var _this = _super.call(this, type, line, column, start, end, raw) || this;
_this.assignee = assignee;
_this.expression = expression;
return _this;
}
BaseAssignOp.prototype.getChildNames = function () {
return ['assignee', 'expression'];
};
return BaseAssignOp;
}(Node));
export { BaseAssignOp };
var AssignOp = /** @class */ (function (_super) {
__extends(AssignOp, _super);
function AssignOp(line, column, start, end, raw, assignee, expression) {
return _super.call(this, 'AssignOp', line, column, start, end, raw, assignee, expression) || this;
}
AssignOp.prototype.withExpression = function (expression) {
return new AssignOp(this.line, this.column, this.start, this.end, this.raw, this.assignee, expression);
};
return AssignOp;
}(BaseAssignOp));
export { AssignOp };
var CompoundAssignOp = /** @class */ (function (_super) {
__extends(CompoundAssignOp, _super);
function CompoundAssignOp(line, column, start, end, raw, assignee, expression, op) {
var _this = _super.call(this, 'CompoundAssignOp', line, column, start, end, raw, assignee, expression) || this;
_this.op = op;
return _this;
}
return CompoundAssignOp;
}(BaseAssignOp));
export { CompoundAssignOp };
var ExtendsOp = /** @class */ (function (_super) {
__extends(ExtendsOp, _super);
function ExtendsOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'ExtendsOp', line, column, start, end, raw, left, right) || this;
}
return ExtendsOp;
}(BinaryOp));
export { ExtendsOp };
var SeqOp = /** @class */ (function (_super) {
__extends(SeqOp, _super);
function SeqOp(line, column, start, end, raw, left, right) {
return _super.call(this, 'SeqOp', line, column, start, end, raw, left, right) || this;
}
return SeqOp;
}(BinaryOp));
export { SeqOp };
var TypeofOp = /** @class */ (function (_super) {
__extends(TypeofOp, _super);
function TypeofOp(line, column, start, end, raw, expression) {
return _super.call(this, 'TypeofOp', line, column, start, end, raw, expression) || this;
}
return TypeofOp;
}(UnaryOp));
export { TypeofOp };
var InstanceofOp = /** @class */ (function (_super) {
__extends(InstanceofOp, _super);
function InstanceofOp(line, column, start, end, raw, left, right, isNot) {
var _this = _super.call(this, 'InstanceofOp', line, column, start, end, raw, left, right) || this;
_this.isNot = isNot;
return _this;
}
return InstanceofOp;
}(BinaryOp));
export { InstanceofOp };
var OfOp = /** @class */ (function (_super) {
__extends(OfOp, _super);
function OfOp(line, column, start, end, raw, left, right, isNot) {
var _this = _super.call(this, 'OfOp', line, column, start, end, raw, left, right) || this;
_this.isNot = isNot;
return _this;
}
return OfOp;
}(BinaryOp));
export { OfOp };
var DeleteOp = /** @class */ (function (_super) {
__extends(DeleteOp, _super);
function DeleteOp(line, column, start, end, raw, expression) {
return _super.call(this, 'DeleteOp', line, column, start, end, raw, expression) || this;
}
return DeleteOp;
}(UnaryOp));
export { DeleteOp };
var Yield = /** @class */ (function (_super) {
__extends(Yield, _super);
function Yield(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'Yield', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
Yield.prototype.getChildNames = function () {
return ['expression'];
};
return Yield;
}(Node));
export { Yield };
var YieldFrom = /** @class */ (function (_super) {
__extends(YieldFrom, _super);
function YieldFrom(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'YieldFrom', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
YieldFrom.prototype.getChildNames = function () {
return ['expression'];
};
return YieldFrom;
}(Node));
export { YieldFrom };
var Await = /** @class */ (function (_super) {
__extends(Await, _super);
function Await(line, column, start, end, raw, expression) {
var _this = _super.call(this, 'Await', line, column, start, end, raw) || this;
_this.expression = expression;
return _this;
}
Await.prototype.getChildNames = function () {
return ['expression'];
};
return Await;
}(Node));
export { Await };
var Slice = /** @class */ (function (_super) {
__extends(Slice, _super);
function Slice(line, column, start, end, raw, expression, left, right, isInclusive) {
var _this = _super.call(this, 'Slice', line, column, start, end, raw) || this;
_this.expression = expression;
_this.left = left;
_this.right = right;
_this.isInclusive = isInclusive;
return _this;
}
Slice.prototype.getChildNames = function () {
return ['expression', 'left', 'right'];
};
return Slice;
}(Node));
export { Slice };
var SoakedSlice = /** @class */ (function (_super) {
__extends(SoakedSlice, _super);
function SoakedSlice(line, column, start, end, raw, expression, left, right, isInclusive) {
var _this = _super.call(this, 'SoakedSlice', line, column, start, end, raw) || this;
_this.expression = expression;
_this.left = left;
_this.right = right;
_this.isInclusive = isInclusive;
return _this;
}
SoakedSlice.prototype.getChildNames = function () {
return ['expression', 'left', 'right'];
};
return SoakedSlice;
}(Node));
export { SoakedSlice };
var BaseFunction = /** @class */ (function (_super) {
__extends(BaseFunction, _super);
function BaseFunction(type, line, column, start, end, raw, parameters, body) {
var _this = _super.call(this, type, line, column, start, end, raw) || this;
_this.parameters = parameters;
_this.body = body;
return _this;
}
BaseFunction.prototype.getChildNames = function () {
return ['parameters', 'body'];
};
return BaseFunction;
}(Node));
export { BaseFunction };
var Function = /** @class */ (function (_super) {
__extends(Function, _super);
function Function(line, column, start, end, raw, parameters, body) {
return _super.call(this, 'Function', line, column, start, end, raw, parameters, body) || this;
}
Function.prototype.withParameters = function (parameters) {
return new Function(this.line, this.column, this.start, this.end, this.raw, parameters, this.body);
};
return Function;
}(BaseFunction));
export { Function };
var BoundFunction = /** @class */ (function (_super) {
__extends(BoundFunction, _super);
function BoundFunction(line, column, start, end, raw, parameters, body) {
return _super.call(this, 'BoundFunction', line, column, start, end, raw, parameters, body) || this;
}
BoundFunction.prototype.withParameters = function (parameters) {
return new BoundFunction(this.line, this.column, this.start, this.end, this.raw, parameters, this.body);
};
return BoundFunction;
}(BaseFunction));
export { BoundFunction };
var GeneratorFunction = /** @class */ (function (_super) {
__extends(GeneratorFunction, _super);
function GeneratorFunction(line, column, start, end, raw, parameters, body) {
return _super.call(this, 'GeneratorFunction', line, column, start, end, raw, parameters, body) || this;
}
GeneratorFunction.prototype.withParameters = function (parameters) {
return new GeneratorFunction(this.line, this.column, this.start, this.end, this.raw, parameters, this.body);
};
return GeneratorFunction;
}(BaseFunction));
export { GeneratorFunction };
var BoundGeneratorFunction = /** @class */ (function (_super) {
__extends(BoundGeneratorFunction, _super);
function BoundGeneratorFunction(line, column, start, end, raw, parameters, body) {
return _super.call(this, 'BoundGeneratorFunction', line, column, start, end, raw, parameters, body) || this;
}
BoundGeneratorFunction.prototype.withParameters = function (parameters) {
return new BoundGeneratorFunction(this.line, this.column, this.start, this.end, this.raw, parameters, this.body);
};
return BoundGeneratorFunction;
}(BaseFunction));
export { BoundGeneratorFunction };
var AsyncFunction = /** @class */ (function (_super) {
__extends(AsyncFunction, _super);
function AsyncFunction(line, column, start, end, raw, parameters, body) {
return _super.call(this, 'AsyncFunction', line, column, start, end, raw, parameters, body) || this;
}
AsyncFunction.prototype.withParameters = function (parameters) {
return new AsyncFunction(this.line, this.column, this.start, this.end, this.raw, parameters, this.body);
};
return AsyncFunction;
}(BaseFunction));
export { AsyncFunction };
var BoundAsyncFunction = /** @class */ (function (_super) {
__extends(BoundAsyncFunction, _super);
function BoundAsyncFunction(line, column, start, end, raw, parameters, body) {
return _super.call(this, 'BoundAsyncFunction', line, column, start, end, raw, parameters, body) || this;
}
BoundAsyncFunction.prototype.withParameters = function (parameters) {
return new BoundAsyncFunction(this.line, this.column, this.start, this.end, this.raw, parameters, this.body);
};
return BoundAsyncFunction;
}(BaseFunction));
export { BoundAsyncFunction };
var Try = /** @class */ (function (_super) {
__extends(Try, _super);
function Try(line, column, start, end, raw, body, catchAssignee, catchBody, finallyBody) {
var _this = _super.call(this, 'Try', line, column, start, end, raw) || this;
_this.body = body;
_this.catchAssignee = catchAssignee;
_this.catchBody = catchBody;
_this.finallyBody = finallyBody;
return _this;
}
Try.prototype.getChildNames = function () {
return ['body', 'catchAssignee', 'catchBody', 'finallyBody'];
};
return Try;
}(Node));
export { Try };
var Constructor = /** @class */ (function (_super) {
__extends(Constructor, _super);
function Constructor(line, column, start, end, raw, assignee, expression) {
return _super.call(this, 'Constructor', line, column, start, end, raw, assignee, expression) || this;
}
return Constructor;
}(BaseAssignOp));
export { Constructor };
var ClassProtoAssignOp = /** @class */ (function (_super) {
__extends(ClassProtoAssignOp, _super);
function ClassProtoAssignOp(line, column, start, end, raw, assignee, expression) {
return _super.call(this, 'ClassProtoAssignOp', line, column, start, end, raw, assignee, expression) || this;
}
return ClassProtoAssignOp;
}(BaseAssignOp));
export { ClassProtoAssignOp };
var Class = /** @class */ (function (_super) {
__extends(Class, _super);
function Class(line, column, start, end, raw, nameAssignee, name, body, boundMembers, parent, ctor) {
var _this = _super.call(this, 'Class', line, column, start, end, raw) || this;
_this.nameAssignee = nameAssignee;
_this.name = name;
_this.body = body;
_this.boundMembers = boundMembers;
_this.parent = parent;
_this.ctor = ctor;
return _this;
}
Class.prototype.getChildNames = function () {
return ['nameAssignee', 'parent', 'body'];
};
return Class;
}(Node));
export { Class };
var FunctionApplication = /** @class */ (function (_super) {
__extends(FunctionApplication, _super);
function FunctionApplication(line, column, start, end, raw, fn, args) {
var _this = _super.call(this, 'FunctionApplication', line, column, start, end, raw) || this;
_this["function"] = fn;
_this.arguments = args;
return _this;
}
FunctionApplication.prototype.getChildNames = function () {
return ['function', 'arguments'];
};
return FunctionApplication;
}(Node));
export { FunctionApplication };
var SoakedFunctionApplication =