class documentation

class NewTypeAnalyzer: (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method analyze​_newtype​_declaration Return the NewType call expression if s is a newtype declaration or None otherwise.
Method build​_newtype​_typeinfo Undocumented
Method check​_newtype​_args Ananlyze base type in NewType call.
Method fail Undocumented
Method make​_argument Undocumented
Method process​_newtype​_declaration Check if s declares a NewType; if yes, store it in symbol table.
Instance Variable api Undocumented
Instance Variable msg Undocumented
Instance Variable options Undocumented
def __init__(self, options, api, msg): (source)

Undocumented

Parameters
options:OptionsUndocumented
api:SemanticAnalyzerInterfaceUndocumented
msg:MessageBuilderUndocumented
def analyze_newtype_declaration(self, s): (source)
Return the NewType call expression if s is a newtype declaration or None otherwise.
Parameters
s:AssignmentStmtUndocumented
Returns
Tuple[Optional[str], Optional[CallExpr]]Undocumented
def build_newtype_typeinfo(self, name, old_type, base_type, line): (source)

Undocumented

Parameters
name:strUndocumented
old​_type:TypeUndocumented
base​_type:InstanceUndocumented
line:intUndocumented
Returns
TypeInfoUndocumented
def check_newtype_args(self, name, call, context): (source)

Ananlyze base type in NewType call.

Return a tuple (type, should defer).

Parameters
name:strUndocumented
call:CallExprUndocumented
context:ContextUndocumented
Returns
Tuple[Optional[Type], bool]Undocumented
def fail(self, msg, ctx, *, code=None): (source)

Undocumented

Parameters
msg:strUndocumented
ctx:ContextUndocumented
code:Optional[ErrorCode]Undocumented
def make_argument(self, name, type): (source)

Undocumented

Parameters
name:strUndocumented
type:TypeUndocumented
Returns
ArgumentUndocumented
def process_newtype_declaration(self, s): (source)

Check if s declares a NewType; if yes, store it in symbol table.

Return True if it's a NewType declaration. The current target may be deferred as a side effect if the base type is not ready, even if the return value is True.

The logic in this function mostly copies the logic for visit_class_def() with a single (non-Generic) base.

Parameters
s:AssignmentStmtUndocumented
Returns
boolUndocumented

Undocumented

Undocumented

options = (source)

Undocumented