MCPcopy Index your code
hub / github.com/python/mypy / add_argument

Method add_argument

mypyc/irbuild/builder.py:1425–1434  ·  view source on GitHub ↗

Declare an argument in the current function. You should use this instead of directly calling add_local() in new code.

(self, var: str | Var, typ: RType, kind: ArgKind = ARG_POS)

Source from the content-addressed store, hash-verified

1423 self.functions.append(ir)
1424
1425 def add_argument(self, var: str | Var, typ: RType, kind: ArgKind = ARG_POS) -> Register:
1426 """Declare an argument in the current function.
1427
1428 You should use this instead of directly calling add_local() in new code.
1429 """
1430 if isinstance(var, str):
1431 var = Var(var)
1432 reg = self.add_local(var, typ, is_arg=True)
1433 self.runtime_args[-1].append(RuntimeArg(var.name, typ, kind))
1434 return reg
1435
1436 def lookup(self, symbol: SymbolNode) -> SymbolTarget:
1437 return self.symtables[-1][symbol]

Callers 15

enter_methodMethod · 0.95
parse_optionsFunction · 0.80
parse_optionsFunction · 0.80
mainFunction · 0.80
add_invertible_flagFunction · 0.80
define_optionsFunction · 0.80
worker.pyFile · 0.80
client.pyFile · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 5

add_localMethod · 0.95
VarClass · 0.90
RuntimeArgClass · 0.90
isinstanceFunction · 0.85
appendMethod · 0.80

Tested by 1

parse_optionsFunction · 0.64