Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Can't import at module level as ecmavisitor depends
# on ast module...
from cobra.compiler import ECMAVisitor
visitor = ECMAVisitor()
return visitor.visit(self)
class SetOfNodes(Node):
pass
class Program(Node):
pass
class Block(Node):
pass
class Boolean(Node):
def __init__(self, value):
self.value = value
def children(self):
return []
class Null(Node):
def __init__(self, value):
self.value = value
def children(self):
return []
class Number(Node):
def __init__(self, value):
self.value = value
class Return(Node):
def __init__(self, expr=None):
self.expr = expr
def children(self):
return [self.expr]
class With(Node):
def __init__(self, expr, statement):
self.expr = expr
self.statement = statement
def children(self):
return [self.expr, self.statement]
class Switch(Node):
def __init__(self, expr, cases, default=None):
self.expr = expr
self.cases = cases
self.default = default
def children(self):
return [self.expr] + self.cases + [self.default]
class Case(Node):
def __init__(self, expr, elements):
self.expr = expr
self.elements = elements if elements is not None else []
def children(self):
return [self.expr] + self.elements
self.identifier._mangle_candidate = True
for param in self.parameters:
param._mangle_candidate = True
def children(self):
return [self.identifier] + self.parameters + self.elements
class FuncDecl(FuncBase):
pass
# The only difference is that function expression might not have an identifier
class FuncExpr(FuncBase):
pass
class Comma(Node):
def __init__(self, left, right):
self.left = left
self.right = right
def children(self):
return [self.left, self.right]
class EmptyStatement(Node):
def __init__(self, value):
self.value = value
def children(self):
return []
class ExprStatement(Node):
def __init__(self, expr):
self.expr = expr
self.statement = statement
def children(self):
return [self.expr, self.statement]
class Switch(Node):
def __init__(self, expr, cases, default=None):
self.expr = expr
self.cases = cases
self.default = default
def children(self):
return [self.expr] + self.cases + [self.default]
class Case(Node):
def __init__(self, expr, elements):
self.expr = expr
self.elements = elements if elements is not None else []
def children(self):
return [self.expr] + self.elements
class Default(Node):
def __init__(self, elements):
self.elements = elements if elements is not None else []
def children(self):
return self.elements
class Label(Node):
def __init__(self, identifier, statement):
class EmptyStatement(Node):
def __init__(self, value):
self.value = value
def children(self):
return []
class ExprStatement(Node):
def __init__(self, expr):
self.expr = expr
def children(self):
return [self.expr]
class Elision(Node):
def __init__(self, value):
self.value = value
def children(self):
return []
class This(Node):
def __init__(self):
pass
def children(self):
return []
def __init__(self, predicate, statement):
self.predicate = predicate
self.statement = statement
def children(self):
return [self.predicate, self.statement]
class While(Node):
def __init__(self, predicate, statement):
self.predicate = predicate
self.statement = statement
def children(self):
return [self.predicate, self.statement]
class For(Node):
def __init__(self, init, cond, count, statement):
self.init = init
self.cond = cond
self.count = count
self.statement = statement
def children(self):
return [self.init, self.cond, self.count, self.statement]
class ForIn(Node):
def __init__(self, item, iterable, statement):
self.item = item
self.iterable = iterable
self.statement = statement
def children(self):
self.consequent = consequent
self.alternative = alternative
def children(self):
return [self.predicate, self.consequent, self.alternative]
class If(Node):
def __init__(self, predicate, consequent, alternative=None):
self.predicate = predicate
self.consequent = consequent
self.alternative = alternative
def children(self):
return [self.predicate, self.consequent, self.alternative]
class DoWhile(Node):
def __init__(self, predicate, statement):
self.predicate = predicate
self.statement = statement
def children(self):
return [self.predicate, self.statement]
class While(Node):
def __init__(self, predicate, statement):
self.predicate = predicate
self.statement = statement
def children(self):
return [self.predicate, self.statement]
class For(Node):
self.count = count
self.statement = statement
def children(self):
return [self.init, self.cond, self.count, self.statement]
class ForIn(Node):
def __init__(self, item, iterable, statement):
self.item = item
self.iterable = iterable
self.statement = statement
def children(self):
return [self.item, self.iterable, self.statement]
class Continue(Node):
def __init__(self, identifier=None):
self.identifier = identifier
def children(self):
return [self.identifier]
class Break(Node):
def __init__(self, identifier=None):
self.identifier = identifier
def children(self):
return [self.identifier]
class Return(Node):
def __init__(self, expr=None):
self.expr = expr
self.left = left
self.right = right
def children(self):
return [self.left, self.right]
class GetPropAssign(Node):
def __init__(self, prop_name, elements):
"""elements - function body"""
self.prop_name = prop_name
self.elements = elements
def children(self):
return [self.prop_name] + self.elements
class SetPropAssign(Node):
def __init__(self, prop_name, parameters, elements):
"""elements - function body"""
self.prop_name = prop_name
self.parameters = parameters
self.elements = elements
def children(self):
return [self.prop_name] + self.parameters + self.elements
class VarStatement(Node):
pass
class VarDecl(Node):
def __init__(self, identifier, initializer=None):
self.identifier = identifier
self.identifier._mangle_candidate = True
self.expr = expr
self.cases = cases
self.default = default
def children(self):
return [self.expr] + self.cases + [self.default]
class Case(Node):
def __init__(self, expr, elements):
self.expr = expr
self.elements = elements if elements is not None else []
def children(self):
return [self.expr] + self.elements
class Default(Node):
def __init__(self, elements):
self.elements = elements if elements is not None else []
def children(self):
return self.elements
class Label(Node):
def __init__(self, identifier, statement):
self.identifier = identifier
self.statement = statement
def children(self):
return [self.identifier, self.statement]
class Throw(Node):
def __init__(self, expr):