TopLevelItemParser
Instance methods
parse_abstract_method(loc : Location, receiver : Ast::Parameter, inherited_type_params : Slice(Ast::TypeParameter) | Nil, trait_methods : Array(Ast::AbstractMethod))
SourceParses : BLOCK_OF_STATEMENTS
parse_constructor(loc : Location, return_type : Ast::Type, type_params : Slice(Ast::TypeParameter) | Nil = nil)
Sourceparse_fn_block(fn_loc : Location, inherited_type_params : Slice(Ast::TypeParameter) | Nil = nil, receiver : Ast::Parameter | Nil = nil, trait_method_array : Array(Ast::AbstractMethod) | Nil = nil, external = false)
Sourceparse_method(loc : Location, receiver : Ast::Parameter, inherited_type_params : Slice(Ast::TypeParameter) | Nil = nil)
Parses a def method in a type declaration block. Examples:
fn method_name(param String) -> return_type: <function body>fn mut mutable_method(param Int): <function body>fn foo[T](a T) -> let T: <function body>fn +(other Self) -> Self: <function body>-- overloads + operatorfn field_name -> FieldType: <function body>-- acts as a getterfn String String: <function body>-- overloads String constructor
parse_parameter
Sourceparse_signature(sig_loc : Location, inherited_type_params : Slice(Ast::TypeParameter) | Nil = nil, receiver : Ast::Parameter | Nil = nil) : Ast::Signature | Nil
Sourceparse_static(loc : Location, type_name : String, inherited_type_params : Slice(Ast::TypeParameter) | Nil = nil)
Sourceparses a struct, including traits, fields, methods, and any other sub-items
struct Point is Stringable
field x Int
field y Int
parse_top_level_item
Sourceparse_type_header
Sourceparse_type_parameters?(inherited_type_params : Slice(Ast::TypeParameter) | Nil = nil) : Slice(Ast::TypeParameter) | Nil
Parses [T, U: Constraint] or [A, B: Constraint1 & Constraint2]