MCPcopy Create free account
hub / github.com/nodejs/node / as_const

Method as_const

deps/v8/third_party/jinja2/nodes.py:497–510  ·  view source on GitHub ↗
(self, eval_ctx: t.Optional[EvalContext] = None)

Source from the content-addressed store, hash-verified

495 abstract = True
496
497 def as_const(self, eval_ctx: t.Optional[EvalContext] = None) -> t.Any:
498 eval_ctx = get_eval_context(self, eval_ctx)
499
500 # intercepted operators cannot be folded at compile time
501 if (
502 eval_ctx.environment.sandboxed
503 and self.operator in eval_ctx.environment.intercepted_binops # type: ignore
504 ):
505 raise Impossible()
506 f = _binop_to_func[self.operator]
507 try:
508 return f(self.left.as_const(eval_ctx), self.right.as_const(eval_ctx))
509 except Exception as e:
510 raise Impossible() from e
511
512
513class UnaryExpr(Expr):

Callers

nothing calls this directly

Calls 4

get_eval_contextFunction · 0.70
ImpossibleClass · 0.70
fFunction · 0.50
as_constMethod · 0.45

Tested by

no test coverage detected