core: Replace TopLevelDef comments with documentation
This commit is contained in:
parent
2b635a0b97
commit
36a6a7b8cd
@ -82,51 +82,55 @@ pub struct FunInstance {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum TopLevelDef {
|
pub enum TopLevelDef {
|
||||||
Class {
|
Class {
|
||||||
// name for error messages and symbols
|
/// Name for error messages and symbols.
|
||||||
name: StrRef,
|
name: StrRef,
|
||||||
// object ID used for TypeEnum
|
/// Object ID used for [TypeEnum].
|
||||||
object_id: DefinitionId,
|
object_id: DefinitionId,
|
||||||
/// type variables bounded to the class.
|
/// type variables bounded to the class.
|
||||||
type_vars: Vec<Type>,
|
type_vars: Vec<Type>,
|
||||||
// class fields
|
/// Class fields.
|
||||||
// name, type, is mutable
|
///
|
||||||
|
/// Name and type is mutable.
|
||||||
fields: Vec<(StrRef, Type, bool)>,
|
fields: Vec<(StrRef, Type, bool)>,
|
||||||
// class methods, pointing to the corresponding function definition.
|
/// Class methods, pointing to the corresponding function definition.
|
||||||
methods: Vec<(StrRef, Type, DefinitionId)>,
|
methods: Vec<(StrRef, Type, DefinitionId)>,
|
||||||
// ancestor classes, including itself.
|
/// Ancestor classes, including itself.
|
||||||
ancestors: Vec<TypeAnnotation>,
|
ancestors: Vec<TypeAnnotation>,
|
||||||
// symbol resolver of the module defined the class, none if it is built-in type
|
/// Symbol resolver of the module defined the class; [None] if it is built-in type.
|
||||||
resolver: Option<Arc<dyn SymbolResolver + Send + Sync>>,
|
resolver: Option<Arc<dyn SymbolResolver + Send + Sync>>,
|
||||||
// constructor type
|
/// Constructor type.
|
||||||
constructor: Option<Type>,
|
constructor: Option<Type>,
|
||||||
// definition location
|
/// Definition location.
|
||||||
loc: Option<Location>,
|
loc: Option<Location>,
|
||||||
},
|
},
|
||||||
Function {
|
Function {
|
||||||
// prefix for symbol, should be unique globally
|
/// Prefix for symbol, should be unique globally.
|
||||||
name: String,
|
name: String,
|
||||||
// simple name, the same as in method/function definition
|
/// Simple name, the same as in method/function definition.
|
||||||
simple_name: StrRef,
|
simple_name: StrRef,
|
||||||
// function signature.
|
/// Function signature.
|
||||||
signature: Type,
|
signature: Type,
|
||||||
// instantiated type variable IDs
|
/// Instantiated type variable IDs.
|
||||||
var_id: Vec<u32>,
|
var_id: Vec<u32>,
|
||||||
/// Function instance to symbol mapping
|
/// Function instance to symbol mapping
|
||||||
/// Key: string representation of type variable values, sorted by variable ID in ascending
|
///
|
||||||
|
/// * Key: String representation of type variable values, sorted by variable ID in ascending
|
||||||
/// order, including type variables associated with the class.
|
/// order, including type variables associated with the class.
|
||||||
/// Value: function symbol name.
|
/// * Value: Function symbol name.
|
||||||
instance_to_symbol: HashMap<String, String>,
|
instance_to_symbol: HashMap<String, String>,
|
||||||
/// Function instances to annotated AST mapping
|
/// Function instances to annotated AST mapping
|
||||||
/// Key: string representation of type variable values, sorted by variable ID in ascending
|
///
|
||||||
|
/// * Key: String representation of type variable values, sorted by variable ID in ascending
|
||||||
/// order, including type variables associated with the class. Excluding rigid type
|
/// order, including type variables associated with the class. Excluding rigid type
|
||||||
/// variables.
|
/// variables.
|
||||||
/// rigid type variables that would be substituted when the function is instantiated.
|
///
|
||||||
|
/// Rigid type variables that would be substituted when the function is instantiated.
|
||||||
instance_to_stmt: HashMap<String, FunInstance>,
|
instance_to_stmt: HashMap<String, FunInstance>,
|
||||||
// symbol resolver of the module defined the class
|
/// Symbol resolver of the module defined the class.
|
||||||
resolver: Option<Arc<dyn SymbolResolver + Send + Sync>>,
|
resolver: Option<Arc<dyn SymbolResolver + Send + Sync>>,
|
||||||
// custom codegen callback
|
/// Custom code generation callback.
|
||||||
codegen_callback: Option<Arc<GenCall>>,
|
codegen_callback: Option<Arc<GenCall>>,
|
||||||
// definition location
|
/// Definition location.
|
||||||
loc: Option<Location>,
|
loc: Option<Location>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user