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

Method _Condition

deps/v8/tools/cppgc/gen_cmake.py:152–169  ·  view source on GitHub ↗

Visit GN condition: if (cond) {then_stmts} else {else_stmts}

(self, cond_expr, then_stmts, else_stmts=None)

Source from the content-addressed store, hash-verified

150 self.current_target, [str(token) for token in right.children])
151
152 def _Condition(self, cond_expr, then_stmts, else_stmts=None):
153 'Visit GN condition: if (cond) {then_stmts} else {else_stmts}'
154 cond_expr = self._Expr(cond_expr)
155 then_stmts = self._StatementList(then_stmts.children)
156 if not then_stmts:
157 # Ignore conditions with empty then stmts.
158 return
159 if else_stmts is None:
160 return self.builder.BuildCondition(cond_expr, then_stmts)
161 elif else_stmts.data == 'condition':
162 else_cond = self._Condition(*else_stmts.children)
163 return self.builder.BuildConditionWithElseCond(
164 cond_expr, then_stmts, else_cond)
165 else:
166 assert 'statement_list' == else_stmts.data
167 else_stmts = self._StatementList(else_stmts.children)
168 return self.builder.BuildConditionWithElseStmts(
169 cond_expr, then_stmts, else_stmts)
170
171 def _Expr(self, expr):
172 'Post-order traverse expression trees'

Callers

nothing calls this directly

Calls 5

_ExprMethod · 0.95
_StatementListMethod · 0.95
BuildConditionMethod · 0.80

Tested by

no test coverage detected