MCPcopy
hub / github.com/hylang/hy / _compile_branch

Method _compile_branch

hy/compiler.py:467–482  ·  view source on GitHub ↗

Make a branch out of an iterable of Result objects This generates a Result from the given sequence of Results, forcing each expression context as a statement before the next result is used. We keep the expression context of the last argument for the returned Result

(self, exprs)

Source from the content-addressed store, hash-verified

465
466 @builds_model(Lazy)
467 def _compile_branch(self, exprs):
468 """Make a branch out of an iterable of Result objects
469
470 This generates a Result from the given sequence of Results, forcing each
471 expression context as a statement before the next result is used.
472
473 We keep the expression context of the last argument for the returned Result
474 """
475 result = Result()
476 last = None
477 for node in exprs:
478 if last is not None:
479 result += last.expr_as_stmt()
480 last = self.compile(node)
481 result += last
482 return result
483
484 def _storeize(self, expr, name, func=None):
485 """Return a new `name` object with an ast.Store() context"""

Callers 11

compile_doFunction · 0.80
compile_eval_foo_compileFunction · 0.80
compile_comprehensionFunction · 0.80
fFunction · 0.80
compile_while_expressionFunction · 0.80
compile_with_expressionFunction · 0.80
compile_match_expressionFunction · 0.80
compile_try_expressionFunction · 0.80
compile_function_lambdaFunction · 0.80
compile_function_defFunction · 0.80
compile_class_expressionFunction · 0.80

Calls 3

compileMethod · 0.95
ResultClass · 0.85
expr_as_stmtMethod · 0.80

Tested by

no test coverage detected