Exemplo n.º 1
0
    def terminate_value(self):
        """
        Returns the last recorded terminate value of a function scope that the function had returned early.

        :return: the terminate value
        """
        raise lib.SplException("Terminate value outside function.")
Exemplo n.º 2
0
    def resume_loop(self):
        """
        Resumes a paused loop environment.

        If this scope is not paused, this method can still be called but makes no effect.

        :return: None
        """
        raise lib.SplException("Not inside loop.")
Exemplo n.º 3
0
    def pause_loop(self):
        """
        Pauses the loop for one iteration.

        This method is called when the keyword 'continue' is executed.

        :return: None
        """
        raise lib.SplException("Continue not inside loop.")
Exemplo n.º 4
0
def eval_def(node: ast.DefStmt, env: en.Environment):
    block: ast.BlockStmt = node.params
    params_lst = []
    for p in block.lines:
        # p: ast.Node
        if p.node_type == ast.TYPE_NODE:
            p: ast.TypeNode
            name = p.left.name
            tal = get_tal_of_defining_node(p.right, env)
        else:
            raise lib.SplException(
                "Unexpected syntax in function parameter, in file '{}', at line {}."
                .format(node.file, node.line_num))
        pair = ParameterPair(name, tal)
        params_lst.append(pair)

    f = Function(params_lst, node.body, env, node.doc)
    f.file = node.file
    f.line_num = node.line_num
    f.r_tal = get_tal_of_defining_node(node.r_type, env)
    return f
Exemplo n.º 5
0
 def break_loop(self):
     raise lib.SplException("Break not inside loop.")
Exemplo n.º 6
0
 def terminate(self, exit_value):
     raise lib.SplException("Return outside function.")