Skip to content

Commit

Permalink
reformat with prettier 2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
cseufert committed Jun 14, 2021
1 parent eece6dc commit 2def6b1
Show file tree
Hide file tree
Showing 92 changed files with 990 additions and 791 deletions.
18 changes: 10 additions & 8 deletions src/ast/array.js
Expand Up @@ -33,11 +33,13 @@ const KIND = "array";
* @property {Entry|Expr|Variable} items List of array items
* @property {boolean} shortForm Indicate if the short array syntax is used, ex `[]` instead `array()`
*/
module.exports = Expr.extends(
KIND,
function Array(shortForm, items, docs, location) {
Expr.apply(this, [KIND, docs, location]);
this.items = items;
this.shortForm = shortForm;
}
);
module.exports = Expr.extends(KIND, function Array(
shortForm,
items,
docs,
location
) {
Expr.apply(this, [KIND, docs, location]);
this.items = items;
this.shortForm = shortForm;
});
39 changes: 18 additions & 21 deletions src/ast/arrowfunc.js
Expand Up @@ -19,24 +19,21 @@ const KIND = "arrowfunc";
* @property {boolean} nullable
* @property {boolean} isStatic
*/
module.exports = Expression.extends(
KIND,
function Closure(
args,
byref,
body,
type,
nullable,
isStatic,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.arguments = args;
this.byref = byref;
this.body = body;
this.type = type;
this.nullable = nullable;
this.isStatic = isStatic || false;
}
);
module.exports = Expression.extends(KIND, function Closure(
args,
byref,
body,
type,
nullable,
isStatic,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.arguments = args;
this.byref = byref;
this.body = body;
this.type = type;
this.nullable = nullable;
this.isStatic = isStatic || false;
});
21 changes: 12 additions & 9 deletions src/ast/assign.js
Expand Up @@ -16,12 +16,15 @@ const KIND = "assign";
* @property {Expression} right
* @property {String} operator
*/
module.exports = Expression.extends(
KIND,
function Assign(left, right, operator, docs, location) {
Expression.apply(this, [KIND, docs, location]);
this.left = left;
this.right = right;
this.operator = operator;
}
);
module.exports = Expression.extends(KIND, function Assign(
left,
right,
operator,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.left = left;
this.right = right;
this.operator = operator;
});
18 changes: 10 additions & 8 deletions src/ast/assignref.js
Expand Up @@ -16,11 +16,13 @@ const KIND = "assignref";
* @property {Expression} right
* @property {String} operator
*/
module.exports = Expression.extends(
KIND,
function AssignRef(left, right, docs, location) {
Expression.apply(this, [KIND, docs, location]);
this.left = left;
this.right = right;
}
);
module.exports = Expression.extends(KIND, function AssignRef(
left,
right,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.left = left;
this.right = right;
});
18 changes: 10 additions & 8 deletions src/ast/attribute.js
Expand Up @@ -15,11 +15,13 @@ const KIND = "attribute";
* @property {String} name
* @property {Parameter[]} args
*/
module.exports = Node.extends(
KIND,
function Attribute(name, args, docs, location) {
Node.apply(this, [KIND, docs, location]);
this.name = name;
this.args = args;
}
);
module.exports = Node.extends(KIND, function Attribute(
name,
args,
docs,
location
) {
Node.apply(this, [KIND, docs, location]);
this.name = name;
this.args = args;
});
21 changes: 12 additions & 9 deletions src/ast/bin.js
Expand Up @@ -15,12 +15,15 @@ const KIND = "bin";
* @property {Expression} left
* @property {Expression} right
*/
module.exports = Operation.extends(
KIND,
function Bin(type, left, right, docs, location) {
Operation.apply(this, [KIND, docs, location]);
this.type = type;
this.left = left;
this.right = right;
}
);
module.exports = Operation.extends(KIND, function Bin(
type,
left,
right,
docs,
location
) {
Operation.apply(this, [KIND, docs, location]);
this.type = type;
this.left = left;
this.right = right;
});
16 changes: 9 additions & 7 deletions src/ast/block.js
Expand Up @@ -14,10 +14,12 @@ const KIND = "block";
* @extends {Statement}
* @property {Node[]} children
*/
module.exports = Statement.extends(
KIND,
function Block(kind, children, docs, location) {
Statement.apply(this, [kind || KIND, docs, location]);
this.children = children.filter(Boolean);
}
);
module.exports = Statement.extends(KIND, function Block(
kind,
children,
docs,
location
) {
Statement.apply(this, [kind || KIND, docs, location]);
this.children = children.filter(Boolean);
});
14 changes: 8 additions & 6 deletions src/ast/boolean.js
Expand Up @@ -13,9 +13,11 @@ const KIND = "boolean";
* @constructor Boolean
* @extends {Literal}
*/
module.exports = Literal.extends(
KIND,
function Boolean(value, raw, docs, location) {
Literal.apply(this, [KIND, value, raw, docs, location]);
}
);
module.exports = Literal.extends(KIND, function Boolean(
value,
raw,
docs,
location
) {
Literal.apply(this, [KIND, value, raw, docs, location]);
});
18 changes: 10 additions & 8 deletions src/ast/call.js
Expand Up @@ -15,11 +15,13 @@ const KIND = "call";
* @property {Identifier|Variable|??} what
* @property {Arguments[]} arguments
*/
module.exports = Expression.extends(
KIND,
function Call(what, args, docs, location) {
Expression.apply(this, [KIND, docs, location]);
this.what = what;
this.arguments = args;
}
);
module.exports = Expression.extends(KIND, function Call(
what,
args,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.what = what;
this.arguments = args;
});
18 changes: 10 additions & 8 deletions src/ast/case.js
Expand Up @@ -15,11 +15,13 @@ const KIND = "case";
* @property {Expression|null} test - if null, means that the default case
* @property {Block|null} body
*/
module.exports = Statement.extends(
KIND,
function Case(test, body, docs, location) {
Statement.apply(this, [KIND, docs, location]);
this.test = test;
this.body = body;
}
);
module.exports = Statement.extends(KIND, function Case(
test,
body,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
this.test = test;
this.body = body;
});
21 changes: 12 additions & 9 deletions src/ast/cast.js
Expand Up @@ -16,12 +16,15 @@ const KIND = "cast";
* @property {String} raw
* @property {Expression} expr
*/
module.exports = Operation.extends(
KIND,
function Cast(type, raw, expr, docs, location) {
Operation.apply(this, [KIND, docs, location]);
this.type = type;
this.raw = raw;
this.expr = expr;
}
);
module.exports = Operation.extends(KIND, function Cast(
type,
raw,
expr,
docs,
location
) {
Operation.apply(this, [KIND, docs, location]);
this.type = type;
this.raw = raw;
this.expr = expr;
});
21 changes: 12 additions & 9 deletions src/ast/catch.js
Expand Up @@ -17,12 +17,15 @@ const KIND = "catch";
* @property {Statement} body
* @see http://php.net/manual/en/language.exceptions.php
*/
module.exports = Statement.extends(
KIND,
function Catch(body, what, variable, docs, location) {
Statement.apply(this, [KIND, docs, location]);
this.body = body;
this.what = what;
this.variable = variable;
}
);
module.exports = Statement.extends(KIND, function Catch(
body,
what,
variable,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
this.body = body;
this.what = what;
this.variable = variable;
});
29 changes: 17 additions & 12 deletions src/ast/class.js
Expand Up @@ -20,15 +20,20 @@ const KIND = "class";
* @property {boolean} isAbstract
* @property {boolean} isFinal
*/
module.exports = Declaration.extends(
KIND,
function Class(name, ext, impl, body, flags, docs, location) {
Declaration.apply(this, [KIND, name, docs, location]);
this.isAnonymous = name ? false : true;
this.extends = ext;
this.implements = impl;
this.body = body;
this.attrGroups = [];
this.parseFlags(flags);
}
);
module.exports = Declaration.extends(KIND, function Class(
name,
ext,
impl,
body,
flags,
docs,
location
) {
Declaration.apply(this, [KIND, name, docs, location]);
this.isAnonymous = name ? false : true;
this.extends = ext;
this.implements = impl;
this.body = body;
this.attrGroups = [];
this.parseFlags(flags);
});
17 changes: 10 additions & 7 deletions src/ast/classconstant.js
Expand Up @@ -19,13 +19,16 @@ const IS_PRIVATE = "private";
* @extends {ConstantStatement}
* @property {string} visibility
*/
const ClassConstant = ConstantStatement.extends(
KIND,
function ClassConstant(kind, constants, flags, docs, location) {
ConstantStatement.apply(this, [kind || KIND, constants, docs, location]);
this.parseFlags(flags);
}
);
const ClassConstant = ConstantStatement.extends(KIND, function ClassConstant(
kind,
constants,
flags,
docs,
location
) {
ConstantStatement.apply(this, [kind || KIND, constants, docs, location]);
this.parseFlags(flags);
});

/**
* Generic flags parser
Expand Down
43 changes: 20 additions & 23 deletions src/ast/closure.js
Expand Up @@ -21,26 +21,23 @@ const KIND = "closure";
* @property {boolean} isStatic
* @property {AttrGroup[]} attrGroups
*/
module.exports = Expression.extends(
KIND,
function Closure(
args,
byref,
uses,
type,
nullable,
isStatic,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.uses = uses;
this.arguments = args;
this.byref = byref;
this.type = type;
this.nullable = nullable;
this.isStatic = isStatic || false;
this.body = null;
this.attrGroups = [];
}
);
module.exports = Expression.extends(KIND, function Closure(
args,
byref,
uses,
type,
nullable,
isStatic,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.uses = uses;
this.arguments = args;
this.byref = byref;
this.type = type;
this.nullable = nullable;
this.isStatic = isStatic || false;
this.body = null;
this.attrGroups = [];
});

0 comments on commit 2def6b1

Please sign in to comment.