sun::serialization::ASTSerializer
class · Source (opens in a new tab)
class sun::serialization::ASTSerializerSerialize AST nodes to protobuf format.
Public Functions
- ASTSerializer
- serialize
- serializeConstantValue
- serializeProgram
- serializeProgramToString
- serializePrototype
- serializeToString
ASTSerializer
public · function · Source (opens in a new tab)
sun::serialization::ASTSerializer::ASTSerializer(SerializerConfig config={})Creates a syntax-tree encoder using the supplied serialization settings.
Related: SerializerConfig
serialize
public · function · Source (opens in a new tab)
pbc::ASTNode sun::serialization::ASTSerializer::serialize(const ExprAST &expr) constSerialize any expression node.
Related: ExprAST
serializeConstantValue
public · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeConstantValue(const sun::semantic_analysis::constants::ConstantValue &value, pbc::ConstantValue *proto) constWrites a value the compiler computed for a global.
Its type is not written: the reader takes it from the global's own type.
Related: sun::semantic_analysis::constants::ConstantValue
serializeProgram
public · function · Source (opens in a new tab)
pbc::Program sun::serialization::ASTSerializer::serializeProgram(const BlockExprAST &root) constSerialize a complete program (root block).
Related: BlockExprAST
serializeProgramToString
public · function · Source (opens in a new tab)
std::string sun::serialization::ASTSerializer::serializeProgramToString(const BlockExprAST &root) constEncodes a program syntax tree as a protobuf byte string.
Related: BlockExprAST
serializePrototype
public · function · Source (opens in a new tab)
pbc::Prototype sun::serialization::ASTSerializer::serializePrototype(const sun::ast::PrototypeAST &proto) constSerialize a prototype (non-ExprAST node).
Related: sun::ast::PrototypeAST
serializeToString
public · function · Source (opens in a new tab)
std::string sun::serialization::ASTSerializer::serializeToString(const ExprAST &expr) constSerialize to bytes (convenience).
Related: ExprAST
Private Functions
- serializeArray
- serializeArrayIndex
- serializeBinary
- serializeBlock
- serializeBlockInto
- serializeBool
- serializeCall
- serializeCharLiteral
- serializeClassDef
- serializeCompoundAssignment
- serializeDeclareType
- serializeEnumDef
- serializeExprBase
- serializeFieldInto
- serializeFor
- serializeForIn
- serializeFunction
- serializeGenericCall
- serializeIdentity
- serializeIf
- serializeIndex
- serializeIndexedAssignment
- serializeInterfaceDef
- serializeInterpolatedString
- serializeLambda
- serializeManifest
- serializeMatch
- serializeMemberAccess
- serializeMemberAssignment
- serializeMethodFunction
- serializeModule
- serializeNumber
- serializePackExpansion
- serializeParen
- serializePosition
- serializeQualifiedName
- serializeReferenceCreation
- serializeReturn
- serializeSlice
- serializeSliceInto
- serializeString
- serializeStructLiteral
- serializeTernary
- serializeThrow
- serializeToken
- serializeTryCatch
- serializeTypeAnnotation
- serializeTypeParameterInto
- serializeUnary
- serializeUnsafeBlock
- serializeUsing
- serializeVariableAssignment
- serializeVariableCreation
- serializeVariableRef
- serializeWhile
serializeArray
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeArray(const sun::ast::ArrayLiteralAST &expr, pbc::ASTNode *node) constEncodes a array literal and its child data in the protobuf syntax representation.
Related: sun::ast::ArrayLiteralAST
serializeArrayIndex
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeArrayIndex(const sun::ast::ArrayIndexAST &expr, pbc::ASTNode *node) constEncodes a array index and its child data in the protobuf syntax representation.
Related: sun::ast::ArrayIndexAST
serializeBinary
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeBinary(const sun::ast::BinaryExprAST &expr, pbc::ASTNode *node) constEncodes a binary operation and its child data in the protobuf syntax representation.
Related: sun::ast::BinaryExprAST
serializeBlock
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeBlock(const BlockExprAST &expr, pbc::ASTNode *node) constEncodes a lexical block and its child data in the protobuf syntax representation.
Related: BlockExprAST
serializeBlockInto
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeBlockInto(const BlockExprAST &block, pbc::BlockExpr *proto) constStatements and span of a block that is stored without a node wrapper (function bodies, module bodies, try and catch blocks).
Related: BlockExprAST
serializeBool
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeBool(const sun::ast::BoolLiteralAST &expr, pbc::ASTNode *node) constEncodes a boolean literal and its child data in the protobuf syntax representation.
Related: sun::ast::BoolLiteralAST
serializeCall
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeCall(const sun::ast::CallExprAST &expr, pbc::ASTNode *node) constEncodes a function call and its child data in the protobuf syntax representation.
Related: sun::ast::CallExprAST
serializeCharLiteral
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeCharLiteral(const sun::ast::CharLiteralAST &expr, pbc::ASTNode *node) constEncodes a character literal and its child data in the protobuf syntax representation.
Related: sun::ast::CharLiteralAST
serializeClassDef
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeClassDef(const sun::ast::ClassDefinitionAST &expr, pbc::ASTNode *node) constEncodes a class declaration and its child data in the protobuf syntax representation.
Related: sun::ast::ClassDefinitionAST
serializeCompoundAssignment
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeCompoundAssignment(const sun::ast::CompoundAssignmentAST &expr, pbc::ASTNode *node) constEncodes a compound assignment and its child data in the protobuf syntax representation.
Related: sun::ast::CompoundAssignmentAST
serializeDeclareType
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeDeclareType(const sun::ast::DeclareTypeAST &expr, pbc::ASTNode *node) constEncodes a forward type declaration and its child data in the protobuf syntax representation.
Related: sun::ast::DeclareTypeAST
serializeEnumDef
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeEnumDef(const sun::ast::EnumDefinitionAST &expr, pbc::ASTNode *node) constEncodes a enum declaration and its child data in the protobuf syntax representation.
Related: sun::ast::EnumDefinitionAST
serializeExprBase
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeExprBase(const ExprAST &expr, pbc::ASTNode *node) constSet common ExprAST fields on the proto message.
serializeFieldInto
private · function · Source (opens in a new tab)
template <typename FieldDecl, typename FieldProto>
void sun::serialization::ASTSerializer::serializeFieldInto(const FieldDecl &field, FieldProto *proto) constClass and interface fields are declared alike, so they store alike.
serializeFor
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeFor(const sun::ast::ForExprAST &expr, pbc::ASTNode *node) constEncodes a for loop and its child data in the protobuf syntax representation.
Related: sun::ast::ForExprAST
serializeForIn
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeForIn(const sun::ast::ForInExprAST &expr, pbc::ASTNode *node) constEncodes a iteration loop and its child data in the protobuf syntax representation.
Related: sun::ast::ForInExprAST
serializeFunction
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeFunction(const sun::ast::FunctionAST &expr, pbc::ASTNode *node) constEncodes a function definition and its child data in the protobuf syntax representation.
Related: sun::ast::FunctionAST
serializeGenericCall
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeGenericCall(const sun::ast::GenericCallAST &expr, pbc::ASTNode *node) constEncodes a generic function call and its child data in the protobuf syntax representation.
Related: sun::ast::GenericCallAST
serializeIdentity
private · function · Source (opens in a new tab)
pbc::DeclarationIdentity sun::serialization::ASTSerializer::serializeIdentity(const sun::semantic_analysis::DeclarationIdentity &identity) constExport declaration and binder keys only at the artifact boundary.
Related: sun::semantic_analysis::DeclarationIdentity
serializeIf
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeIf(const sun::ast::IfExprAST &expr, pbc::ASTNode *node) constEncodes a conditional expression and its child data in the protobuf syntax representation.
Related: sun::ast::IfExprAST
serializeIndex
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeIndex(const sun::ast::IndexAST &expr, pbc::ASTNode *node) constEncodes a index expression and its child data in the protobuf syntax representation.
Related: sun::ast::IndexAST
serializeIndexedAssignment
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeIndexedAssignment(const sun::ast::IndexedAssignmentAST &expr, pbc::ASTNode *node) constEncodes a indexed assignment and its child data in the protobuf syntax representation.
Related: sun::ast::IndexedAssignmentAST
serializeInterfaceDef
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeInterfaceDef(const sun::ast::InterfaceDefinitionAST &expr, pbc::ASTNode *node) constEncodes a interface declaration and its child data in the protobuf syntax representation.
Related: sun::ast::InterfaceDefinitionAST
serializeInterpolatedString
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeInterpolatedString(const sun::ast::InterpolatedStringAST &expr, pbc::ASTNode *node) constEncodes a interpolated string and its child data in the protobuf syntax representation.
Related: sun::ast::InterpolatedStringAST
serializeLambda
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeLambda(const sun::ast::LambdaAST &expr, pbc::ASTNode *node) constEncodes a lambda expression and its child data in the protobuf syntax representation.
Related: sun::ast::LambdaAST
serializeManifest
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeManifest(const sun::ast::ManifestAST &expr, pbc::ASTNode *node) constEncodes a dependency manifest and its child data in the protobuf syntax representation.
Related: sun::ast::ManifestAST
serializeMatch
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeMatch(const sun::ast::MatchExprAST &expr, pbc::ASTNode *node) constEncodes a pattern match and its child data in the protobuf syntax representation.
Related: sun::ast::MatchExprAST
serializeMemberAccess
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeMemberAccess(const sun::ast::MemberAccessAST &expr, pbc::ASTNode *node) constEncodes a member access and its child data in the protobuf syntax representation.
Related: sun::ast::MemberAccessAST
serializeMemberAssignment
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeMemberAssignment(const sun::ast::MemberAssignmentAST &expr, pbc::ASTNode *node) constEncodes a member assignment and its child data in the protobuf syntax representation.
Related: sun::ast::MemberAssignmentAST
serializeMethodFunction
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeMethodFunction(const sun::ast::FunctionAST &function, pbc::FunctionDef *proto) constThe function behind a class or interface method.
Related: sun::ast::FunctionAST
serializeModule
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeModule(const sun::ast::ModuleAST &expr, pbc::ASTNode *node) constEncodes a module declaration and its child data in the protobuf syntax representation.
Related: sun::ast::ModuleAST
serializeNumber
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeNumber(const sun::ast::NumberExprAST &expr, pbc::ASTNode *node) constIndividual node type serializers (dispatch by ASTNodeType).
Related: sun::ast::NumberExprAST, ASTNodeType
serializePackExpansion
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializePackExpansion(const sun::ast::PackExpansionAST &expr, pbc::ASTNode *node) constEncodes a variadic argument expansion and its child data in the protobuf syntax representation.
Related: sun::ast::PackExpansionAST
serializeParen
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeParen(const sun::ast::ParenExprAST &expr, pbc::ASTNode *node) constEncodes a parenthesized expression and its child data in the protobuf syntax representation.
Related: sun::ast::ParenExprAST
serializePosition
private · function · Source (opens in a new tab)
pbc::Position sun::serialization::ASTSerializer::serializePosition(const sun::support::Position &pos) constPosition serialization.
Related: sun::support::Position, Position
serializeQualifiedName
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeQualifiedName(const sun::ast::QualifiedNameAST &expr, pbc::ASTNode *node) constEncodes a qualified name and its child data in the protobuf syntax representation.
Related: sun::ast::QualifiedNameAST
serializeReferenceCreation
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeReferenceCreation(const sun::ast::ReferenceCreationAST &expr, pbc::ASTNode *node) constEncodes a reference creation and its child data in the protobuf syntax representation.
Related: sun::ast::ReferenceCreationAST
serializeReturn
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeReturn(const sun::ast::ReturnExprAST &expr, pbc::ASTNode *node) constEncodes a return statement and its child data in the protobuf syntax representation.
Related: sun::ast::ReturnExprAST
serializeSlice
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeSlice(const sun::ast::SliceExprAST &expr, pbc::ASTNode *node) constEncodes a slice expression and its child data in the protobuf syntax representation.
Related: sun::ast::SliceExprAST
serializeSliceInto
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeSliceInto(const sun::ast::SliceExprAST &slice, pbc::SliceExpr *proto) constOne index of a subscript: a[i] and a[i..j] share a slice message.
Related: sun::ast::SliceExprAST
serializeString
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeString(const sun::ast::StringLiteralAST &expr, pbc::ASTNode *node) constEncodes a string literal and its child data in the protobuf syntax representation.
Related: sun::ast::StringLiteralAST
serializeStructLiteral
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeStructLiteral(const sun::ast::StructLiteralAST &expr, pbc::ASTNode *node) constEncodes a field initializer list and its child data in the protobuf syntax representation.
Related: sun::ast::StructLiteralAST
serializeTernary
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeTernary(const sun::ast::TernaryExprAST &expr, pbc::ASTNode *node) constEncodes a conditional expression and its child data in the protobuf syntax representation.
Related: sun::ast::TernaryExprAST
serializeThrow
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeThrow(const sun::ast::ThrowExprAST &expr, pbc::ASTNode *node) constEncodes a throw expression and its child data in the protobuf syntax representation.
Related: sun::ast::ThrowExprAST
serializeToken
private · function · Source (opens in a new tab)
pbc::Token sun::serialization::ASTSerializer::serializeToken(const sun::parsing::Token &token) constToken serialization (for operators).
Related: sun::parsing::Token, Token
serializeTryCatch
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeTryCatch(const sun::ast::TryCatchExprAST &expr, pbc::ASTNode *node) constEncodes a error handler and its child data in the protobuf syntax representation.
Related: sun::ast::TryCatchExprAST
serializeTypeAnnotation
private · function · Source (opens in a new tab)
pbc::TypeAnnotation sun::serialization::ASTSerializer::serializeTypeAnnotation(const sun::ast::TypeAnnotation &type) constType annotation serialization.
Related: sun::ast::TypeAnnotation
serializeTypeParameterInto
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeTypeParameterInto(const sun::ast::TypeParameter ¶meter, pbc::TypeParameter *proto) constStore a parameter and its optional constraint for any declaration kind.
Related: sun::ast::TypeParameter
serializeUnary
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeUnary(const sun::ast::UnaryExprAST &expr, pbc::ASTNode *node) constEncodes a unary operation and its child data in the protobuf syntax representation.
Related: sun::ast::UnaryExprAST
serializeUnsafeBlock
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeUnsafeBlock(const sun::ast::UnsafeBlockAST &expr, pbc::ASTNode *node) constEncodes a unsafe block and its child data in the protobuf syntax representation.
Related: sun::ast::UnsafeBlockAST
serializeUsing
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeUsing(const sun::ast::UsingAST &expr, pbc::ASTNode *node) constEncodes a using declaration and its child data in the protobuf syntax representation.
Related: sun::ast::UsingAST
serializeVariableAssignment
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeVariableAssignment(const sun::ast::VariableAssignmentAST &expr, pbc::ASTNode *node) constEncodes a variable assignment and its child data in the protobuf syntax representation.
Related: sun::ast::VariableAssignmentAST
serializeVariableCreation
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeVariableCreation(const sun::ast::VariableCreationAST &expr, pbc::ASTNode *node) constEncodes a variable declaration and its child data in the protobuf syntax representation.
Related: sun::ast::VariableCreationAST
serializeVariableRef
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeVariableRef(const sun::ast::VariableReferenceAST &expr, pbc::ASTNode *node) constEncodes a variable reference and its child data in the protobuf syntax representation.
Related: sun::ast::VariableReferenceAST
serializeWhile
private · function · Source (opens in a new tab)
void sun::serialization::ASTSerializer::serializeWhile(const sun::ast::WhileExprAST &expr, pbc::ASTNode *node) constEncodes a while loop and its child data in the protobuf syntax representation.
Related: sun::ast::WhileExprAST
Private Fields
config_
private · variable · Source (opens in a new tab)
SerializerConfig sun::serialization::ASTSerializer::config_No documentation comment.
Related: SerializerConfig