Returns decl as source text, or an empty string if it cannot be printed. The caller frees the string.
Compiler :: #import "Compiler";
decl: Compiler.Code_Declaration;
decl.kind = .DECLARATION;
decl.name = "answer";
decl.flags = .IS_CONSTANT;
decl.expression = Compiler.make_integer_literal(42);
assert(print_declaration(*decl) == "answer:: 42");print_declaration :: (decl: *C.Code_Declaration) -> string
Parameters
- decl: *C.Code_Declaration
Returns
- string
print_declaration :: (
builder: *Basic.String_Builder,
decl: *C.Code_Declaration,
print_using := true,
compound: *C.Code_Compound_Declaration = null,
print_type := true
) -> bool
Writes decl to builder. Returns false if it cannot be printed.
print_using includes a using prefix, compound is the multi-name declaration this one belongs to, and print_type includes the type.
Parameters
- builder: *Basic.String_Builder
- decl: *C.Code_Declaration
- print_using := true
- compound: *C.Code_Compound_Declaration = null
- print_type := true
Returns
- bool