pub struct Ast { /* private fields */ }Expand description
Every node of one translation unit.
Implementations§
Source§impl Ast
impl Ast
Sourcepub fn top_level(&self) -> &[DeclId] ⓘ
pub fn top_level(&self) -> &[DeclId] ⓘ
The declarations of the translation unit, in source order.
Sourcepub fn add_top_level(&mut self, decl: DeclId)
pub fn add_top_level(&mut self, decl: DeclId)
Adds a declaration at file scope.
Sourcepub fn expr(&mut self, expr: Expr, span: Span) -> ExprId
pub fn expr(&mut self, expr: Expr, span: Span) -> ExprId
Adds an expression, with the source it came from.
§Panics
Panics if the arena would exceed four billion nodes, which is not a translation unit this compiler intends to accept.
Sourcepub fn stmt(&mut self, stmt: Stmt, span: Span) -> StmtId
pub fn stmt(&mut self, stmt: Stmt, span: Span) -> StmtId
Adds a statement, with the source it came from.
§Panics
Panics if the arena would exceed four billion nodes.
Sourcepub fn decl(&mut self, decl: Decl, span: Span) -> DeclId
pub fn decl(&mut self, decl: Decl, span: Span) -> DeclId
Adds a declaration, with the source it came from.
§Panics
Panics if the arena would exceed four billion nodes.
Source§impl Ast
impl Ast
Sourcepub fn add_declarator(&mut self, item: Declarator) -> DeclaratorId
pub fn add_declarator(&mut self, item: Declarator) -> DeclaratorId
Source§impl Ast
impl Ast
Sourcepub fn add_type_name(&mut self, item: TypeName) -> TypeNameId
pub fn add_type_name(&mut self, item: TypeName) -> TypeNameId
Source§impl Ast
impl Ast
Sourcepub fn add_specs(&mut self, item: DeclSpecs) -> DeclSpecsId
pub fn add_specs(&mut self, item: DeclSpecs) -> DeclSpecsId
Adds a set of declaration specifiers.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_string(&mut self, item: StringLiteral) -> StrId
pub fn add_string(&mut self, item: StringLiteral) -> StrId
Source§impl Ast
impl Ast
Sourcepub fn add_expr_list(&mut self, items: &[ExprId]) -> ExprList
pub fn add_expr_list(&mut self, items: &[ExprId]) -> ExprList
Adds a run of expressions, such as the arguments of a call.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_stmt_list(&mut self, items: &[StmtId]) -> StmtList
pub fn add_stmt_list(&mut self, items: &[StmtId]) -> StmtList
Adds a run of statements, such as the body of a compound statement.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_decl_list(&mut self, items: &[DeclId]) -> DeclList
pub fn add_decl_list(&mut self, items: &[DeclId]) -> DeclList
Adds a run of declarations, such as the parameter declarations of an old-style function definition.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_str_list(&mut self, items: &[StrId]) -> StrList
pub fn add_str_list(&mut self, items: &[StrId]) -> StrList
Adds a run of string literals, such as an asm clobber list.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_symbol_list(&mut self, items: &[Symbol]) -> SymbolList
pub fn add_symbol_list(&mut self, items: &[Symbol]) -> SymbolList
Adds a run of identifiers, such as the labels of an asm goto.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_attr_args(&mut self, items: &[AttrArg]) -> AttrArgList
pub fn add_attr_args(&mut self, items: &[AttrArg]) -> AttrArgList
Source§impl Ast
impl Ast
Sourcepub fn add_derived_list(&mut self, items: &[Derived]) -> DerivedList
pub fn add_derived_list(&mut self, items: &[Derived]) -> DerivedList
Adds a run of declarator derivations, from the name outward.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_member_list(&mut self, items: &[Member]) -> MemberList
pub fn add_member_list(&mut self, items: &[Member]) -> MemberList
Adds a run of struct or union members.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_enumerator_list(&mut self, items: &[Enumerator]) -> EnumeratorList
pub fn add_enumerator_list(&mut self, items: &[Enumerator]) -> EnumeratorList
Source§impl Ast
impl Ast
Sourcepub fn add_init_declarator_list(
&mut self,
items: &[InitDeclarator],
) -> InitDeclaratorList
pub fn add_init_declarator_list( &mut self, items: &[InitDeclarator], ) -> InitDeclaratorList
Source§impl Ast
impl Ast
Sourcepub fn add_init_item_list(&mut self, items: &[InitItem]) -> InitItemList
pub fn add_init_item_list(&mut self, items: &[InitItem]) -> InitItemList
Adds a run of braced initializer elements.
§Panics
Panics if the table would exceed four billion entries.
Source§impl Ast
impl Ast
Sourcepub fn add_designator_list(&mut self, items: &[Designator]) -> DesignatorList
pub fn add_designator_list(&mut self, items: &[Designator]) -> DesignatorList
Source§impl Ast
impl Ast
Sourcepub fn add_generic_list(&mut self, items: &[GenericAssoc]) -> GenericList
pub fn add_generic_list(&mut self, items: &[GenericAssoc]) -> GenericList
Source§impl Ast
impl Ast
Sourcepub fn add_asm_operand_list(&mut self, items: &[AsmOperand]) -> AsmOperandList
pub fn add_asm_operand_list(&mut self, items: &[AsmOperand]) -> AsmOperandList
Trait Implementations§
Source§impl Index<Idx<CharConstant>> for Ast
impl Index<Idx<CharConstant>> for Ast
Source§type Output = CharConstant
type Output = CharConstant
Source§impl Index<Idx<Declarator>> for Ast
impl Index<Idx<Declarator>> for Ast
Source§type Output = Declarator
type Output = Declarator
Source§fn index(&self, id: DeclaratorId) -> &Declarator
fn index(&self, id: DeclaratorId) -> &Declarator
container[index]) operation. Read moreSource§impl Index<Idx<FloatConstant>> for Ast
impl Index<Idx<FloatConstant>> for Ast
Source§type Output = FloatConstant
type Output = FloatConstant
Source§impl Index<Idx<IntConstant>> for Ast
impl Index<Idx<IntConstant>> for Ast
Source§type Output = IntConstant
type Output = IntConstant
Source§impl Index<Idx<StringLiteral>> for Ast
impl Index<Idx<StringLiteral>> for Ast
Source§type Output = StringLiteral
type Output = StringLiteral
Source§impl Index<IdxRange<AsmOperand>> for Ast
impl Index<IdxRange<AsmOperand>> for Ast
Source§type Output = [AsmOperand]
type Output = [AsmOperand]
Source§fn index(&self, list: AsmOperandList) -> &[AsmOperand]
fn index(&self, list: AsmOperandList) -> &[AsmOperand]
container[index]) operation. Read moreSource§impl Index<IdxRange<Designator>> for Ast
impl Index<IdxRange<Designator>> for Ast
Source§type Output = [Designator]
type Output = [Designator]
Source§fn index(&self, list: DesignatorList) -> &[Designator]
fn index(&self, list: DesignatorList) -> &[Designator]
container[index]) operation. Read moreSource§impl Index<IdxRange<Enumerator>> for Ast
impl Index<IdxRange<Enumerator>> for Ast
Source§type Output = [Enumerator]
type Output = [Enumerator]
Source§fn index(&self, list: EnumeratorList) -> &[Enumerator]
fn index(&self, list: EnumeratorList) -> &[Enumerator]
container[index]) operation. Read moreSource§impl Index<IdxRange<GenericAssoc>> for Ast
impl Index<IdxRange<GenericAssoc>> for Ast
Source§type Output = [GenericAssoc]
type Output = [GenericAssoc]
Source§fn index(&self, list: GenericList) -> &[GenericAssoc]
fn index(&self, list: GenericList) -> &[GenericAssoc]
container[index]) operation. Read moreSource§impl Index<IdxRange<InitDeclarator>> for Ast
impl Index<IdxRange<InitDeclarator>> for Ast
Source§type Output = [InitDeclarator]
type Output = [InitDeclarator]
Source§fn index(&self, list: InitDeclaratorList) -> &[InitDeclarator]
fn index(&self, list: InitDeclaratorList) -> &[InitDeclarator]
container[index]) operation. Read more