Class EncoderState
Encodes Flame's intermediate representation as Loyc LNodes.
Inheritance
Inherited Members
Namespace: Flame.Ir
Assembly: Flame.Ir.dll
Syntax
public sealed class EncoderState
Constructors
| Improve this Doc View SourceEncoderState()
Instantiates a Flame IR encoder.
Declaration
public EncoderState()
EncoderState(IrCodec)
Instantiates a Flame IR encoder.
Declaration
public EncoderState(IrCodec codec)
Parameters
Type | Name | Description |
---|---|---|
IrCodec | codec | The codec to use for encoding. |
EncoderState(IrCodec, LNodeFactory)
Instantiates a Flame IR encoder.
Declaration
public EncoderState(IrCodec codec, LNodeFactory factory)
Parameters
Type | Name | Description |
---|---|---|
IrCodec | codec | The codec to use for encoding. |
Loyc.Syntax.LNodeFactory | factory | The node factory to use for creating nodes. |
Properties
| Improve this Doc View SourceCodec
Gets the codec used by this encoder.
Declaration
public IrCodec Codec { get; }
Property Value
Type | Description |
---|---|
IrCodec | A Flame IR codec. |
Factory
Gets the node factory for this encoder.
Declaration
public LNodeFactory Factory { get; }
Property Value
Type | Description |
---|---|
Loyc.Syntax.LNodeFactory | A node factory. |
Methods
| Improve this Doc View SourceEncode(AttributeMap)
Encodes an attribute map as a sequence of LNodes.
Declaration
public IEnumerable<LNode> Encode(AttributeMap attributes)
Parameters
Type | Name | Description |
---|---|---|
AttributeMap | attributes | The attribute map to encode. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Loyc.Syntax.LNode> | A list of attribute nodes. |
Encode(FlowGraph)
Encodes a control-flow graph.
Declaration
public LNode Encode(FlowGraph graph)
Parameters
Type | Name | Description |
---|---|---|
FlowGraph | graph | The control-flow graph to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An LNode that represents the control-flow graph. |
Encode(InstructionPrototype)
Encodes an instruction prototype.
Declaration
public LNode Encode(InstructionPrototype prototype)
Parameters
Type | Name | Description |
---|---|---|
InstructionPrototype | prototype | The instruction prototype to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded instruction prototype. |
Encode(Alignment)
Encodes an alignment.
Declaration
public LNode Encode(Alignment alignment)
Parameters
Type | Name | Description |
---|---|---|
Alignment | alignment | Am alignment to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | The encoded alignment. |
Encode(MethodLookup)
Encodes a method lookup strategy as an LNode.
Declaration
public LNode Encode(MethodLookup lookup)
Parameters
Type | Name | Description |
---|---|---|
MethodLookup | lookup | A method lookup strategy. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An LNode that represents |
Encode(Constant)
Encodes a constant value.
Declaration
public LNode Encode(Constant value)
Parameters
Type | Name | Description |
---|---|---|
Constant | value | The value to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded constant value. |
Encode(IAttribute)
Encodes an attribute as an LNode.
Declaration
public LNode Encode(IAttribute attribute)
Parameters
Type | Name | Description |
---|---|---|
IAttribute | attribute | The attribute to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded node. |
Encode(IField)
Encodes a field reference.
Declaration
public LNode Encode(IField field)
Parameters
Type | Name | Description |
---|---|---|
IField | field | The field reference to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded field reference. |
Encode(IGenericMember)
Encodes a generic member reference.
Declaration
public LNode Encode(IGenericMember genericMember)
Parameters
Type | Name | Description |
---|---|---|
IGenericMember | genericMember | The generic member to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded generic member reference. |
Encode(IMethod)
Encodes a method reference.
Declaration
public LNode Encode(IMethod method)
Parameters
Type | Name | Description |
---|---|---|
IMethod | method | The method reference to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded method reference. |
Encode(IProperty)
Encodes a property reference.
Declaration
public LNode Encode(IProperty property)
Parameters
Type | Name | Description |
---|---|---|
IProperty | property | The property reference to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded property reference. |
Encode(IType)
Encodes a type reference.
Declaration
public LNode Encode(IType type)
Parameters
Type | Name | Description |
---|---|---|
IType | type | The type reference to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded type reference. |
Encode(QualifiedName)
Encodes a qualified name as a sequence of simple names.
Declaration
public LNode Encode(QualifiedName name)
Parameters
Type | Name | Description |
---|---|---|
QualifiedName | name | A qualified name to encode. Simple names in the qualified name are encoded as such. Other names are encoded as simple names by taking their string representation. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded node. |
Encode(UnqualifiedName)
Encodes an unqualified name as a simple name.
Declaration
public LNode Encode(UnqualifiedName name)
Parameters
Type | Name | Description |
---|---|---|
UnqualifiedName | name | An unqualified name to encode. Simple names are encoded as such. Other names are encoded as simple names by taking their string representation. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded node. |
Encode(Boolean)
Encodes a Boolean constant.
Declaration
public LNode Encode(bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | value | A Boolean constant to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | The encoded Boolean constant. |
Encode(Int32)
Encodes a 32-bit signed integer constant.
Declaration
public LNode Encode(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | A 32-bit signed integer constant to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | The encoded 32-bit signed integer constant. |
EncodeDefinition(IAssembly)
Encodes an assembly definition.
Declaration
public LNode EncodeDefinition(IAssembly assembly)
Parameters
Type | Name | Description |
---|---|---|
IAssembly | assembly | The assembly definition to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An LNode that represents the assembly definition. |
EncodeDefinition(IType)
Encodes a type definition.
Declaration
public LNode EncodeDefinition(IType typeDefinition)
Parameters
Type | Name | Description |
---|---|---|
IType | typeDefinition | The type definition to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An LNode that represents the type definition. |
EncodeDefinition(ITypeMember)
Encodes a type member definition.
Declaration
public LNode EncodeDefinition(ITypeMember memberDefinition)
Parameters
Type | Name | Description |
---|---|---|
ITypeMember | memberDefinition | The type member definition to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An LNode that represents the type member definition. |
EncodeDefinition(Parameter)
Encodes a parameter definition as an LNode.
Declaration
public LNode EncodeDefinition(Parameter parameter)
Parameters
Type | Name | Description |
---|---|---|
Parameter | parameter | The parameter to encode. |
Returns
Type | Description |
---|---|
Loyc.Syntax.LNode | An encoded node. |
WithCodec(IrCodec)
Creates an encoder state that uses a particular codec but retains all other fields.
Declaration
public EncoderState WithCodec(IrCodec newCodec)
Parameters
Type | Name | Description |
---|---|---|
IrCodec | newCodec | The new codec to use. |
Returns
Type | Description |
---|---|
EncoderState | An encoder state that uses |