Ejemplo n.º 1
0
 def default_parameters():
     """
     Return the defaults parameters of the function, if any.
     """
     return Entity.parameters.filter(
         lambda p: dsl_expr.Not(p.default_expr.is_null)
     )
Ejemplo n.º 2
0
 def resolved_arguments(called_fn=BaseFunction.entity):
     """
     Return the arguments of this call (default arguments included)
     as named arguments.
     """
     return Let(lambda call_args=Self.as_entity.call_args(called_fn): Let(
         lambda default_args=called_fn.default_parameters(
         ).filter(lambda p: dsl_expr.Not(
             call_args.any(lambda e: e.name().text == p.name())
         )).map(lambda param: SynthNamedArg.new(
             arg_name=param.param_identifier.node,
             value_expr=param.default_expr.node).cast(NamedArg).as_entity
                ): call_args.concat(default_args)))
Ejemplo n.º 3
0
 def is_actual_call():
     """
     Return whether this is a call to an actual function (instead of a
     syntactic construct that looks like a function call bu isn't one).
     """
     return dsl_expr.Not(Self.parent.is_a(NodePatternProperty))
Ejemplo n.º 4
0
 def has_parameter(name=T.String):
     """
     Return whether the function has a parameter with the given name.
     """
     return dsl_expr.Not(Self.find_parameter(name).is_null)
Ejemplo n.º 5
0
 def has_name():
     """
     Return whether the argument has a name.
     """
     return dsl_expr.Not(Self.name.is_null)
Ejemplo n.º 6
0
 def has_binding():
     """
     Return whether the node pattern contains a binding name.
     """
     return dsl_expr.Not(Self.binding_name.is_null)