• Home
  • Raw
  • Download

Lines Matching refs:exp

184 validate_expr(struct validator *state, expr_ty exp, expr_context_ty ctx)  in validate_expr()  argument
196 switch (exp->kind) { in validate_expr()
198 actual_ctx = exp->v.Attribute.ctx; in validate_expr()
201 actual_ctx = exp->v.Subscript.ctx; in validate_expr()
204 actual_ctx = exp->v.Starred.ctx; in validate_expr()
207 if (!validate_name(exp->v.Name.id)) { in validate_expr()
210 actual_ctx = exp->v.Name.ctx; in validate_expr()
213 actual_ctx = exp->v.List.ctx; in validate_expr()
216 actual_ctx = exp->v.Tuple.ctx; in validate_expr()
235 switch (exp->kind) { in validate_expr()
237 if (asdl_seq_LEN(exp->v.BoolOp.values) < 2) { in validate_expr()
241 ret = validate_exprs(state, exp->v.BoolOp.values, Load, 0); in validate_expr()
244 ret = validate_expr(state, exp->v.BinOp.left, Load) && in validate_expr()
245 validate_expr(state, exp->v.BinOp.right, Load); in validate_expr()
248 ret = validate_expr(state, exp->v.UnaryOp.operand, Load); in validate_expr()
251 ret = validate_arguments(state, exp->v.Lambda.args) && in validate_expr()
252 validate_expr(state, exp->v.Lambda.body, Load); in validate_expr()
255 ret = validate_expr(state, exp->v.IfExp.test, Load) && in validate_expr()
256 validate_expr(state, exp->v.IfExp.body, Load) && in validate_expr()
257 validate_expr(state, exp->v.IfExp.orelse, Load); in validate_expr()
260 if (asdl_seq_LEN(exp->v.Dict.keys) != asdl_seq_LEN(exp->v.Dict.values)) { in validate_expr()
267 ret = validate_exprs(state, exp->v.Dict.keys, Load, /*null_ok=*/ 1) && in validate_expr()
268 validate_exprs(state, exp->v.Dict.values, Load, /*null_ok=*/ 0); in validate_expr()
271 ret = validate_exprs(state, exp->v.Set.elts, Load, 0); in validate_expr()
275 ret = validate_comprehension(state, exp->v.NAME.generators) && \ in validate_expr()
276 validate_expr(state, exp->v.NAME.elt, Load); \ in validate_expr()
283 ret = validate_comprehension(state, exp->v.DictComp.generators) && in validate_expr()
284 validate_expr(state, exp->v.DictComp.key, Load) && in validate_expr()
285 validate_expr(state, exp->v.DictComp.value, Load); in validate_expr()
288 ret = !exp->v.Yield.value || validate_expr(state, exp->v.Yield.value, Load); in validate_expr()
291 ret = validate_expr(state, exp->v.YieldFrom.value, Load); in validate_expr()
294 ret = validate_expr(state, exp->v.Await.value, Load); in validate_expr()
297 if (!asdl_seq_LEN(exp->v.Compare.comparators)) { in validate_expr()
301 if (asdl_seq_LEN(exp->v.Compare.comparators) != in validate_expr()
302 asdl_seq_LEN(exp->v.Compare.ops)) { in validate_expr()
307 ret = validate_exprs(state, exp->v.Compare.comparators, Load, 0) && in validate_expr()
308 validate_expr(state, exp->v.Compare.left, Load); in validate_expr()
311 ret = validate_expr(state, exp->v.Call.func, Load) && in validate_expr()
312 validate_exprs(state, exp->v.Call.args, Load, 0) && in validate_expr()
313 validate_keywords(state, exp->v.Call.keywords); in validate_expr()
316 if (!validate_constant(state, exp->v.Constant.value)) { in validate_expr()
322 ret = validate_exprs(state, exp->v.JoinedStr.values, Load, 0); in validate_expr()
325 if (validate_expr(state, exp->v.FormattedValue.value, Load) == 0) in validate_expr()
327 if (exp->v.FormattedValue.format_spec) { in validate_expr()
328 ret = validate_expr(state, exp->v.FormattedValue.format_spec, Load); in validate_expr()
334 ret = validate_expr(state, exp->v.Attribute.value, Load); in validate_expr()
337 ret = validate_expr(state, exp->v.Subscript.slice, Load) && in validate_expr()
338 validate_expr(state, exp->v.Subscript.value, Load); in validate_expr()
341 ret = validate_expr(state, exp->v.Starred.value, ctx); in validate_expr()
344 ret = (!exp->v.Slice.lower || validate_expr(state, exp->v.Slice.lower, Load)) && in validate_expr()
345 (!exp->v.Slice.upper || validate_expr(state, exp->v.Slice.upper, Load)) && in validate_expr()
346 (!exp->v.Slice.step || validate_expr(state, exp->v.Slice.step, Load)); in validate_expr()
349 ret = validate_exprs(state, exp->v.List.elts, ctx, 0); in validate_expr()
352 ret = validate_exprs(state, exp->v.Tuple.elts, ctx, 0); in validate_expr()
355 ret = validate_expr(state, exp->v.NamedExpr.value, Load); in validate_expr()
376 ensure_literal_number(expr_ty exp, bool allow_real, bool allow_imaginary) in ensure_literal_number() argument
378 assert(exp->kind == Constant_kind); in ensure_literal_number()
379 PyObject *value = exp->v.Constant.value; in ensure_literal_number()
386 ensure_literal_negative(expr_ty exp, bool allow_real, bool allow_imaginary) in ensure_literal_negative() argument
388 assert(exp->kind == UnaryOp_kind); in ensure_literal_negative()
390 if (exp->v.UnaryOp.op != USub) { in ensure_literal_negative()
394 expr_ty operand = exp->v.UnaryOp.operand; in ensure_literal_negative()
403 ensure_literal_complex(expr_ty exp) in ensure_literal_complex() argument
405 assert(exp->kind == BinOp_kind); in ensure_literal_complex()
406 expr_ty left = exp->v.BinOp.left; in ensure_literal_complex()
407 expr_ty right = exp->v.BinOp.right; in ensure_literal_complex()
409 if (exp->v.BinOp.op != Add && exp->v.BinOp.op != Sub) { in ensure_literal_complex()
443 validate_pattern_match_value(struct validator *state, expr_ty exp) in validate_pattern_match_value() argument
445 if (!validate_expr(state, exp, Load)) { in validate_pattern_match_value()
449 switch (exp->kind) in validate_pattern_match_value()
455 if (!validate_expr(state, exp, Load)) { in validate_pattern_match_value()
458 PyObject *literal = exp->v.Constant.value; in validate_pattern_match_value()
473 if (ensure_literal_negative(exp, /*real=*/true, /*imaginary=*/true)) { in validate_pattern_match_value()
480 if (ensure_literal_complex(exp)) { in validate_pattern_match_value()