class documentation
class NewTypeAnalyzer: (source)
Undocumented
Method | __init__ |
Undocumented |
Method | analyze |
Return the NewType call expression if `s` is a newtype declaration or None otherwise. |
Method | build |
Undocumented |
Method | check |
Ananlyze base type in NewType call. |
Method | fail |
Undocumented |
Method | make |
Undocumented |
Method | process |
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:
Options
, api: SemanticAnalyzerInterface
, msg: MessageBuilder
):
(source)
¶
Undocumented
def analyze_newtype_declaration(self, s:
AssignmentStmt
) -> tuple[ str|None, CallExpr|None]
:
(source)
¶
Return the NewType call expression if `s` is a newtype declaration or None otherwise.
def build_newtype_typeinfo(self, name:
str
, old_type: Type
, base_type: Instance
, line: int
, existing_info: TypeInfo|None
) -> TypeInfo
:
(source)
¶
Undocumented
def check_newtype_args(self, name:
str
, call: CallExpr
, context: Context
) -> tuple[ Type|None, bool]
:
(source)
¶
Ananlyze base type in NewType call. Return a tuple (type, should defer).
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.