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)
| 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] |