New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@algebraic/ast

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algebraic/ast - npm Package Compare versions

Comparing version 1.0.0-alpha.18 to 1.0.0-alpha.19

_template.js

4

comment.js

@@ -8,3 +8,3 @@ const { data, number, string, union } = require("@algebraic/type");

ESTreeBridge `Block` (
({override:type}) => "CommentBlock",
([ESTreeType]) => data.always ("CommentBlock"),
value => string,

@@ -16,3 +16,3 @@ start => number,

ESTreeBridge `Line` (
({override:type}) => "CommentLine",
([ESTreeType]) => data.always ("CommentLine"),
value => string,

@@ -19,0 +19,0 @@ start => number,

const { data } = require("@algebraic/type");
const OverrideTypeRegExp = /^\(\{\s*override:type\s*}\)/;
const isOverrideTypeField = f =>
typeof f === "function" && OverrideTypeRegExp.test(f + "");
// ESTree looks for the "type" property of nodes to identify them. We will be
// extending the types available in ESTree and thus allow one to provide the
// "translation type" if available. We use this for IdentifierPattern and
// IdentifierExpression as they both appear as "Identifier" to ESTree/Babel.
// ESTree looks for the "ESTreeType" property of nodes to identify them. We will
// be extending the types available in ESTree and thus allow one to provide the
// "translation type" if available.
module.exports = function ESTreeBridge ([name])

@@ -14,5 +10,7 @@ {

{
const found = fields.findIndex(isOverrideTypeField);
const ESTreeType = found >= 0 ? fields[found]({}) : name;
const filtered = fields.filter((_, index) => index !== found);
const declarations = fields
.map(field => data.field.toFieldDeclaration(field));
const found = declarations.findIndex(({ name }) => name === "ESTreeType");
const ESTreeType = found >= 0 ? declarations[found].λdefinition([])[1]() : name;
const filtered = declarations.filter((_, index) => index !== found);
const type = data ([name]) (...filtered);

@@ -19,0 +17,0 @@

@@ -6,2 +6,3 @@ const { is, data, nullable, array, or } = require("@algebraic/type");

const { StringSet } = require("./string-set");
const { KeyPathsByName } = require("./key-path");
const compute = require("./compute");

@@ -17,3 +18,3 @@

operator => string,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -24,5 +25,5 @@ take => `right.freeVariables`,

exports.IdentifierExpression = Node `IdentifierExpression` (
({override:type}) => "Identifier",
([ESTreeType]) => data.always ("Identifier"),
name => string,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `name`) );

@@ -38,6 +39,6 @@

([varBindings]) => compute (StringSet,
([varBindings]) => KeyPathsByName.compute (
take => `params.bindingNames` ),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `body.freeVariables`,

@@ -49,4 +50,4 @@ take => `params.freeVariables`,

body => Node.BlockStatement,
id => nullable(Node.IdentifierPattern),
params => array (nullable(Node.RootPattern)),
id => [nullable(Node.IdentifierPattern), null],
params => [array (nullable(Node.RootPattern)), []],

@@ -56,8 +57,8 @@ generator => [boolean, false],

([varBindings]) => compute (StringSet,
([varBindings]) => KeyPathsByName.compute (
take => `id.bindingNames`,
take => `body.varBindingNames`,
take => `params.bindingNames`,
take => StringSet(["arguments"]) ),
([freeVariables]) => compute (StringSet,
take => KeyPathsByName.just("arguments") ),
([freeVariables]) => KeyPathsByName.compute (
take => `body.freeVariables`,

@@ -69,3 +70,3 @@ take => `params.freeVariables`,

elements => array(nullable(or (Node.Expression, Node.SpreadElement))),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `elements.freeVariables`) );

@@ -76,3 +77,3 @@

arguments => array(or (Node.Expression, Node.SpreadElement)),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `callee.freeVariables`,

@@ -85,3 +86,3 @@ take => `arguments.freeVariables` ) );

alternate => Node.Expression,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `test.freeVariables` ,

@@ -95,3 +96,3 @@ take => `consequent.freeVariables`,

operator => string,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -104,3 +105,3 @@ take => `right.freeVariables` ) );

operator => string,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -110,3 +111,3 @@ take => `right.freeVariables` ) );

exports.StaticMemberExpression = Node `StaticMemberExpression` (
({override:type}) => "MemberExpression",
([ESTreeType]) => data.always ("MemberExpression"),
([computed]) => data.always (false),

@@ -117,7 +118,7 @@

optional => [nullable(boolean), null],
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `object.freeVariables`) );
exports.ComputedMemberExpression = Node `ComputedMemberExpression` (
({override:type}) => "MemberExpression",
([ESTreeType]) => data.always ("MemberExpression"),
([computed]) => data.always (true),

@@ -128,3 +129,3 @@

optional => [nullable(boolean), null],
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `object.freeVariables`,

@@ -140,3 +141,3 @@ take => `property.freeVariables` ) );

arguments => array(or (Node.Expression, Node.SpreadElement)),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `callee.freeVariables`,

@@ -146,7 +147,7 @@ take => `arguments.freeVariables` ) );

exports.ThisExpression = Node `ThisExpression` (
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.SequenceExpression = Node `SequenceExpression` (
expressions => array(Node.Expression),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `expressions.freeVariables`) );

@@ -157,3 +158,3 @@

quasi => Node.TemplateLiteral,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `tag.freeVariables`,

@@ -166,3 +167,3 @@ take => `quasi.freeVariables`) );

prefix => [boolean, true],
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables`) );

@@ -174,3 +175,3 @@

prefix => [boolean, true],
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables`) );

@@ -181,3 +182,3 @@

delegate => [boolean, false],
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables`));

@@ -187,7 +188,7 @@

argument => Node.Expression,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables`) );
exports.ObjectPropertyShorthand = Node `ObjectPropertyShorthand` (
({override:type}) => "ObjectProperty",
([ESTreeType]) => data.always ("ObjectProperty"),

@@ -200,7 +201,7 @@ ([shorthand]) => data.always (true),

([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `value.freeVariables`) )
exports.ObjectPropertyLonghand = Node `ObjectPropertyLonghand` (
({override:type}) => "ObjectProperty",
([ESTreeType]) => data.always ("ObjectProperty"),

@@ -215,3 +216,3 @@ ([shorthand]) => data.always (false),

value => Node.Expression,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `key.freeVariables`,

@@ -226,3 +227,3 @@ take => `value.freeVariables` ) );

properties => array ( or(Node.ObjectProperty, Node.SpreadElement)),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `properties.freeVariables`) );

@@ -232,3 +233,3 @@

argument => Node.Expression,
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables`) );

@@ -235,0 +236,0 @@

const Comment = require("./comment");
const { Position, SourceLocation } = require("./source-location");
const { is } = require("@algebraic/type");
const fail = require("@algebraic/type/fail");

@@ -180,3 +181,8 @@ const isNullOrUndefined =

({ extra, ...mappedFields }) =>
type({ ...mappedFields, extra: extra ? ExtraT(extra) : null })]))
type({ ...mappedFields, extra: extra ? ExtraT(extra) : null })])),
Placeholder: ({ name, expectedNode }) =>
expectedNode !== "Expression" ?
fail(`Only PlaceholderExpressions are supported.`) :
Node.PlaceholderExpression({ name: name.name })
});

@@ -183,0 +189,0 @@ })();

const { data, nullable, array } = require("@algebraic/type");
const { boolean, number, string, tundefined } = require("@algebraic/type/primitive");
const Node = require("./node");
const { StringSet } = require("./string-set");
const { KeyPathsByName } = require("./key-path");
const compute = require("./compute");
const Extra = require("./extra");
const Node = require("./node");

@@ -12,7 +14,7 @@

extra => [nullable(Extra(string)), null],
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.BooleanLiteral = Node `BooleanLiteral` (
value => boolean,
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );

@@ -22,6 +24,6 @@ exports.NumericLiteral = Node `NumericLiteral` (

extra => [nullable(Extra(number)), null],
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.NullLiteral = Node `NullLiteral` (
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );

@@ -32,3 +34,3 @@ exports.RegExpLiteral = Node `RegExpLiteral` (

extra => [nullable(Extra(tundefined)), null],
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );

@@ -38,7 +40,8 @@ exports.StringLiteral = Node `StringLiteral` (

extra => [nullable(Extra(string)), null],
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.TemplateElement = Node `TemplateElement` (
value => Node.TemplateElement.Value,
tail => [boolean, false] );
tail => [boolean, false],
([freeVariables]) => data.always (KeyPathsByName.None) );

@@ -52,6 +55,6 @@ exports.TemplateElement.Value = data `TemplateElement.Value` (

quasis => array(Node.TemplateElement),
([freeVariables]) => comput (StringSet,
take => `expressions` ) );
([freeVariables]) => KeyPathsByName.compute (
take => `expressions.freeVariables`) );

@@ -11,3 +11,4 @@ const { isArray } = Array;

mapArray(node, map) :
(mappings[getTypename(of(node))] || mapChildren)(node, map);
mapNode(mappings, node, map);
return map;

@@ -26,13 +27,19 @@ }

function mapChildren(node, map)
function mapNode(mappings, node, map)
{
const mappedChildren = Object
.entries(node)
.filter(([_, node]) => is (Node, node) || isArray(node))
.map(([key, node]) => [key, map(node), node])
.filter(([_, mapped, node]) => node !== mapped)
const type = of(node);
const typename = getTypename(type);
const custom = mappings[typename];
if (custom)
return custom(node, map);
const mappedChildren = type
.traversable
.map(key => [key, map(node[key]), node[key]])
.filter(([_, mapped, node]) => node !== mapped);
return mappedChildren.length <= 0 ?
node :
of(node)({ ...node, ...Object.fromEntries(mappedChildren) });
type({ ...node, ...Object.fromEntries(mappedChildren) });
}
const { IsSymbol } = require("@algebraic/type/declaration");
const { of, data, nullable, array, number, getTypename, or } = require("@algebraic/type");
const { isArray } = Array;
const { is, of, data, union, nullable, array, number, getTypename, or, getKind } = require("@algebraic/type");
const union2 = require("@algebraic/type/union-new");
const { parameters } = require("@algebraic/type").parameterized;
const { Map, List } = require("@algebraic/collections");
const tagged = require("@algebraic/type/tagged");

@@ -47,1 +51,47 @@ const SourceLocation = require("./source-location");

});
// Deal with union2.
// Deal with array<X>.
const isNodeOrComposite = type =>
type === Array ||
type[NodeSymbol] ||
getKind(type) === union2 &&
union2.components(type).some(isNodeOrComposite) ||
getKind(type) === union &&
union.components(type).some(isNodeOrComposite);
Object
.values(Node)
.filter(type => type[NodeSymbol])
.map(type => [type, data.fields(type)
.filter(field =>
is (data.field.definition.supplied, field.definition))
.map(field => [field.name, parameters(field)[0]])
.filter(([name, type]) =>
!name.endsWith("Comments") && isNodeOrComposite(type))
.map(([name]) => name)])
.map(([type, keys]) => type.traversable = keys);
/*
function placeholders(type)
{
const name = "placeholders";
const computed = true;
const λdefinition = function ()
{
const dependencies = type.traversableKeys;
const compute = children => dependencies
.map(key => children[key].placeholders);
field.definition.computed(Map(Node.PlaceholderExpression, boolean))
({ dependencies: traversableKeys, compute: children => })
}
return data.field.deferred({ name, computed, λdefinition });
}
for (const type of Object.values(Node))
if (getKind(type) === data)
console.log(getTypename(type));*/
{
"name": "@algebraic/ast",
"version": "1.0.0-alpha.18",
"version": "1.0.0-alpha.19",
"description": "",

@@ -13,10 +13,11 @@ "main": "node.js",

"dependencies": {
"@babel/generator": "^7.5.0",
"@babel/parser": "^7.5.0",
"@babel/types": "^7.5.0",
"@climb/partition": "1.0.0-alpha.3"
"@climb/partition": "1.0.0-alpha.4"
},
"peerDependencies": {
"@algebraic/type": "1.0.0-alpha.18",
"@algebraic/collectoons": "1.0.0-alpha.18"
"@algebraic/type": "1.0.0-alpha.19",
"@algebraic/collections": "1.0.0-alpha.19"
}
}
const { is, data, or, boolean, string, type, array } = require("@algebraic/type");
const union2 = require("@algebraic/type/union-new");
const Node = require("./node");
const { StringSet } = require("./string-set");
const compute = require("./compute");
const { KeyPathsByName } = require("./key-path");

@@ -17,14 +16,14 @@

exports.IdentifierPattern = Node `IdentifierPattern` (
({override:type}) => "Identifier",
([ESTreeType]) => data.always ("Identifier"),
name => string,
([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `name`),
([freeVariables]) => compute.empty (StringSet) );
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.RestElement = Node `RestElement` (
argument => Node.RootPattern,
([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `argument.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables`) );

@@ -35,5 +34,5 @@

right => Node.Expression,
([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `left.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -44,15 +43,15 @@ take => `right.freeVariables` ) );

elements => array (or (Node.RootPattern, Node.AssignmentPattern)),
([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `elements.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `elements.freeVariables`) );
exports.ShorthandAssignmentPattern = Node `ShorthandAssignmentPattern` (
({override:type}) => "AssignmentPattern",
([ESTreeType]) => data.always ("AssignmentPattern"),
left => Node.IdentifierPattern,
right => Node.Expression,
([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `left.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -62,3 +61,3 @@ take => `right.freeVariables` ));

exports.ObjectPropertyPatternShorthand = Node `ObjectPropertyPatternShorthand` (
({override:type}) => "ObjectProperty",
([ESTreeType]) => data.always ("ObjectProperty"),

@@ -75,9 +74,9 @@ ([shorthand]) => data.always (true),

([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `value.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `value.freeVariables`) );
exports.ObjectPropertyPatternLonghand = Node `ObjectPropertyPatternLonghand` (
({override:type}) => "ObjectProperty",
([ESTreeType]) => data.always ("ObjectProperty"),

@@ -94,5 +93,5 @@ ([shorthand]) => data.always (false),

([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `value.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -107,6 +106,6 @@ take => `right.freeVariables`) );

properties => array (Node.ObjectPropertyPattern ),
([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `properties.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `properties.freeVariables`) );

@@ -5,4 +5,3 @@ const { is, data, nullable, array, or } = require("@algebraic/type");

const Node = require("./node");
const { StringSet } = require("./string-set");
const compute = require("./compute");
const { KeyPathsByName } = require("./key-path");
const Extra = require("./extra");

@@ -22,3 +21,3 @@

exports.Script = Node `Script` (
({override:type}) => "Program",
([ESTreeType]) => data.always ("Program"),
([sourceType]) => data.always ("script"),

@@ -31,7 +30,7 @@

([varBindings]) => compute (StringSet,
([varBindings]) => KeyPathsByName.compute (
take => `body.varBindingNames`),
([blockBindings]) => compute (StringSet,
([blockBindings]) => KeyPathsByName.compute (
take => `body.blockBindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `body.freeVariables`,

@@ -41,18 +40,18 @@ subtract => `varBindings`,

exports.Module = data `Module` (
({override:type}) => "Program",
exports.Module = Node `Module` (
([ESTreeType]) => data.always ("Program"),
([sourceType]) => data.always ("module"),
body => array (or (Node.ImportDeclaration,
Node.ExportDeclaration,
body => array (or (/*Node.ImportDeclaration,
Node.ExportDeclaration,*/
Node.Statement)),
directives => [array(Directive), []],
directives => [array(Node.Directive), []],
interpreter => [nullable(Node.InterpreterDirective), null],
sourceFile => [nullable(string), null],
([varBindings]) => compute (StringSet,
([varBindings]) => KeyPathsByName.compute (
take => `body.varBindingNames`),
([blockBindings]) => compute (StringSet,
([blockBindings]) => KeyPathsByName.compute (
take => `body.blockBindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `body.freeVariables`,

@@ -59,0 +58,0 @@ subtract => `varBindings`,

@@ -10,3 +10,3 @@ const { data, string } = require("@algebraic/type");

// here and pretend to be a ParenthesizedExpression.
exports.ComputedPropertyName = data `ComputedPropertyName` (
exports.ComputedPropertyName = Node `ComputedPropertyName` (
([type]) => data.always ("ParenthesizedExpression"),

@@ -17,3 +17,3 @@

exports.PropertyName = data `PropertyName` (
exports.PropertyName = Node `PropertyName` (
([type]) => data.always ("Identifier"),

@@ -20,0 +20,0 @@

@@ -5,13 +5,11 @@ const { is, data, nullable, array, or } = require("@algebraic/type");

const Node = require("./node");
const { StringSet } = require("./string-set");
const compute = require("./compute");
const FreeVariables = require("./string-set").in `freeVariables`;
const { KeyPathsByName } = require("./key-path");
exports.Label = Node `Label` (
({override:type}) => "Identifier",
([ESTreeType]) => data.always ("Identifier"),
name => string,
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute.empty (StringSet) );
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => data.always (KeyPathsByName.None) );

@@ -21,9 +19,9 @@ exports.BlockStatement = Node `BlockStatement` (

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([blockBindings]) => compute (StringSet,
([blockBindings]) => KeyPathsByName.compute (
take => `body.blockBindingNames` ),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `body.freeVariables`,

@@ -35,16 +33,16 @@ subtract => `varBindingNames`,

label => Node.Label,
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute.empty (StringSet) );
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.ContinueStatement = Node `ContinueStatement` (
label => Node.Label,
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute.empty (StringSet) );
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.DebuggerStatement = Node `DebuggerStatement` (
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute.empty (StringSet) );
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => data.always (KeyPathsByName.None) );

@@ -55,6 +53,6 @@ exports.DoWhileStatement = Node `DoWhileStatement` (

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `body.freeVariables`,

@@ -65,11 +63,11 @@ take => `test.freeVariables`,

exports.EmptyStatement = Node `EmptyStatement` (
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute.empty (StringSet) );
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => data.always (KeyPathsByName.None) );
exports.ExpressionStatement = Node `ExpressionStatement` (
expression => Node.Expression,
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `expression.freeVariables`) );

@@ -86,12 +84,12 @@

([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute (StringSet,
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => KeyPathsByName.compute (
take => `id.bindingNames`),
([varBindings]) => compute (StringSet,
([varBindings]) => KeyPathsByName.compute (
take => `id.bindingNames`,
take => `params.bindingNames`,
take => `body.varBindingNames`,
take => StringSet(["arguments"]) ),
([freeVariables]) => compute (StringSet,
take => KeyPathsByName.just("arguments") ),
([freeVariables]) => KeyPathsByName.compute (
take => `params.freeVariables`,

@@ -105,7 +103,7 @@ take => `body.freeVariables`,

alternate => nullable(Node.Statement),
([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `consequent.varBindingNames`,
take => `alternate.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `test.freeVariables`,

@@ -121,10 +119,10 @@ take => `consequent.freeVariables`,

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `left.varBindingNames`,
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([blockBindings]) => compute (StringSet,
([blockBindings]) => KeyPathsByName.compute (
take => `left.blockBindingNames` ),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -141,10 +139,10 @@ take => `right.freeVariables`,

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `left.varBindingNames`,
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([blockBindings]) => compute (StringSet,
([blockBindings]) => KeyPathsByName.compute (
take => `left.blockBindingNames` ),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `left.freeVariables`,

@@ -163,10 +161,10 @@ take => `right.freeVariables`,

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `init.varBindingNames`,
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([blockBindings]) => compute (StringSet,
([blockBindings]) => KeyPathsByName.compute (
take => `init.blockBindingNames` ),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `init.freeVariables`,

@@ -183,7 +181,7 @@ take => `test.freeVariables`,

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `body.freeVariables` ) );

@@ -193,5 +191,5 @@

argument => Node.Expression,
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables` ) );

@@ -201,5 +199,5 @@

argument => Node.Expression,
([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `argument.freeVariables` ) );

@@ -211,8 +209,8 @@

finalizer => [nullable(Node.BlockStatement), null],
([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `block.varBindingNames`,
take => `handler.varBindingNames`,
take => `finalizer.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `block.freeVariables`,

@@ -227,9 +225,9 @@ take => `handler.freeVariables`,

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => data.always (KeyPathsByName.None),
([blockBindings]) => compute (StringSet,
([blockBindings]) => KeyPathsByName.compute (
take => `param.bindingNames` ),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `param.freeVariables`,

@@ -242,6 +240,6 @@ take => `body.freeVariables`,

body => Node.Statement,
([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `test.freeVariables`,

@@ -254,6 +252,6 @@ take => `body.freeVariables`,

body => Node.Statement,
([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `body.varBindingNames` ),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `object.freeVariables`,

@@ -268,5 +266,5 @@ take => `body.freeVariables`,

([bindingNames]) => compute (StringSet,
([bindingNames]) => KeyPathsByName.compute (
take => `id.bindingNames` ),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `init.freeVariables`,

@@ -276,3 +274,3 @@ take => `id.freeVariables` ) );

exports.VarVariableDeclaration = Node `VarVariableDeclaration` (
({override:type}) => "VariableDeclaration",
([ESTreeType]) => data.always ("VariableDeclaration"),
declarators => array (Node.VariableDeclarator),

@@ -284,6 +282,6 @@ ([declarations]) => [array (Node.VariableDeclarator),

([varBindingNames]) => compute (StringSet,
([varBindingNames]) => KeyPathsByName.compute (
take => `declarators.bindingNames`),
([blockBindingNames]) => compute.empty (StringSet),
([freeVariables]) => compute (StringSet,
([blockBindingNames]) => data.always (KeyPathsByName.None),
([freeVariables]) => KeyPathsByName.compute (
take => `declarators.freeVariables`,

@@ -293,3 +291,3 @@ subtract => `varBindingNames` ) );

exports.BlockVariableDeclaration = Node `BlockVariableDeclaration` (
({override:type}) => "VariableDeclaration",
([ESTreeType]) => data.always ("VariableDeclaration"),
declarators => array (Node.VariableDeclarator),

@@ -301,6 +299,6 @@ ([declarations]) => [array (Node.VariableDeclarator),

([varBindingNames]) => compute.empty (StringSet),
([blockBindingNames]) => compute (StringSet,
([varBindingNames]) => data.always (KeyPathsByName.None),
([blockBindingNames]) => KeyPathsByName.compute (
take => `declarators.bindingNames`),
([freeVariables]) => compute (StringSet,
([freeVariables]) => KeyPathsByName.compute (
take => `declarators.freeVariables`,

@@ -307,0 +305,0 @@ subtract => `blockBindingNames` ) );

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc