Struct MagicMethod

Struct Documentation

struct seq::MagicMethod

Intrinsic magic methods (such as int.__add__).

Magic methods defined within the compiler are basically lambdas that indicate how to perform code generation, with a few other bits of information such as input/output types and a name.

Public Functions

BaseFunc *asFunc(types::Type *type) const

Converts magic method to a BaseFunc

  • type: ‘self’ type

Public Members

std::string name

Full magic method name.

std::vector<types::Type*> args

Magic method argument types, excluding self

types::Type *out

Magic method output type.

std::function<llvm::Value*(llvm::Value*, std::vector<llvm::Value*>, llvm::IRBuilder<>&)> codegen

Code generation function. First argument is self, second is a vector of method arguments, third is an IRBuilder in the target BasicBlock.

bool isStatic

Whether this magic method is static.