Class DecoderState
Decodes Loyc LNodes to Flame's intermediate representation.
Inheritance
Inherited Members
Namespace: Flame.Ir
Assembly: Flame.Ir.dll
Syntax
public sealed class DecoderState
Constructors
| Improve this Doc View SourceDecoderState(ILog, ReadOnlyTypeResolver)
Creates a decoder that relies on the default codec.
Declaration
public DecoderState(ILog log, ReadOnlyTypeResolver typeResolver)
Parameters
Type | Name | Description |
---|---|---|
Pixie.ILog | log | A log to use for error and warning messages. |
ReadOnlyTypeResolver | typeResolver | A read-only type resolver for resolving types. |
DecoderState(ILog, ReadOnlyTypeResolver, IrCodec)
Creates a decoder.
Declaration
public DecoderState(ILog log, ReadOnlyTypeResolver typeResolver, IrCodec codec)
Parameters
Type | Name | Description |
---|---|---|
Pixie.ILog | log | A log to use for error and warning messages. |
ReadOnlyTypeResolver | typeResolver | A read-only type resolver for resolving types. |
IrCodec | codec | A Flame IR codec. |
Properties
| Improve this Doc View SourceCodec
Gets the codec used by this decoder.
Declaration
public IrCodec Codec { get; }
Property Value
Type | Description |
---|---|
IrCodec | The codec. |
DefiningType
Gets the type that either is or defines the current decoding scope.
Declaration
public IType DefiningType { get; }
Property Value
Type | Description |
---|---|
IType |
Log
Gets a log to use for error and warning messages.
Declaration
public ILog Log { get; }
Property Value
Type | Description |
---|---|
Pixie.ILog | A log. |
Scope
Gets the scope in which elements are decoded.
Declaration
public TypeParent Scope { get; }
Property Value
Type | Description |
---|---|
TypeParent | The scope in which elements are decoded, represented as a type parent. |
TypeMemberIndex
Gets an index that allows for quick type member lookup.
Declaration
public Index<IType, UnqualifiedName, ITypeMember> TypeMemberIndex { get; }
Property Value
Type | Description |
---|---|
Index<IType, UnqualifiedName, ITypeMember> | A type member lookup index. |
TypeResolver
Gets the read-only type resolver for this decoder state.
Declaration
public ReadOnlyTypeResolver TypeResolver { get; }
Property Value
Type | Description |
---|---|
ReadOnlyTypeResolver | A type resolver. |
Methods
| Improve this Doc View SourceAssertDecodeEnum<T>(LNode, IReadOnlyDictionary<Symbol, T>, String, out T)
Decodes an id node using a symbol-to-value mapping. An error is reported if the node cannot be decoded.
Declaration
public bool AssertDecodeEnum<T>(LNode node, IReadOnlyDictionary<Symbol, T> decodeMap, string enumDescription, out T result)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A node to decode. |
System.Collections.Generic.IReadOnlyDictionary<Loyc.Symbol, T> | decodeMap | A mapping of symbols to values that is used for decoding the node. |
System.String | enumDescription | A short description of the type of value that is being decoded, e.g., "method lookup strategy". |
T | result | The decoded value, if any. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Type Parameters
Name | Description |
---|---|
T |
AssertDecodeGenericMember(LNode, out IGenericMember)
Decodes an LNode as a reference to a generic member. Logs an error if the decoding process fails.
Declaration
public bool AssertDecodeGenericMember(LNode node, out IGenericMember genericMember)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A node to decode as a generic member. |
IGenericMember | genericMember | The generic member described by |
Returns
Type | Description |
---|---|
System.Boolean |
|
AssertDecodeInt32(LNode, out Int32)
Decodes an LNode as a 32-bit signed integer constant and returns a Boolean flag telling if the decoding operation was successful.
Declaration
public bool AssertDecodeInt32(LNode node, out int result)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
System.Int32 | result | A 32-bit signed integer. |
Returns
Type | Description |
---|---|
System.Boolean |
|
AssertDecodeQualifiedName(LNode, out QualifiedName)
Decodes an LNode as a qualified name. Logs an error if the decoding process fails.
Declaration
public bool AssertDecodeQualifiedName(LNode node, out QualifiedName name)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A node to decode as a qualified name. |
QualifiedName | name | The name described by |
Returns
Type | Description |
---|---|
System.Boolean |
|
AssertDecodeSimpleName(LNode, out SimpleName)
Decodes an LNode as a simple name. Logs an error if the decoding process fails.
Declaration
public bool AssertDecodeSimpleName(LNode node, out SimpleName name)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A node to decode as a simple name. |
SimpleName | name | The name described by |
Returns
Type | Description |
---|---|
System.Boolean |
|
DecodeAlignment(LNode)
Decodes an LNode as an alignment.
Declaration
public Alignment DecodeAlignment(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A node to decode as an alignment. |
Returns
Type | Description |
---|---|
Alignment | The decoded alignment. |
DecodeAssembly(LNode)
Decodes an assembly.
Declaration
public IAssembly DecodeAssembly(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The assembly to decode. |
Returns
Type | Description |
---|---|
IAssembly | A decoded assembly. |
DecodeAttribute(LNode)
Decodes an attribute node.
Declaration
public IAttribute DecodeAttribute(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The attribute node to decode. |
Returns
Type | Description |
---|---|
IAttribute | An attribute node. |
DecodeAttributeMap(IEnumerable<LNode>)
Decodes a sequence of attribute nodes as an attribute map.
Declaration
public AttributeMap DecodeAttributeMap(IEnumerable<LNode> attributeNodes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Loyc.Syntax.LNode> | attributeNodes | The nodes to decode. |
Returns
Type | Description |
---|---|
AttributeMap | An attribute map. |
DecodeBoolean(LNode)
Decodes an LNode as a Boolean constant.
Declaration
public bool DecodeBoolean(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
System.Boolean | A Boolean constant. |
DecodeConstant(LNode)
Decodes an LNode as a constant value.
Declaration
public Constant DecodeConstant(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
Constant | A decoded constant. |
DecodeField(LNode)
Decoes an LNode as a field reference.
Declaration
public IField DecodeField(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
IField | A decode field reference. |
DecodeFlowGraph(LNode)
Decodes a control-flow graph as a method body.
Declaration
public FlowGraph DecodeFlowGraph(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | An encoded control-flow graph. |
Returns
Type | Description |
---|---|
FlowGraph | A new method body that includes the decoded control-flow graph. |
DecodeGenericParameterDefinition(LNode)
Decodes an LNode as a generic parameter definition.
Declaration
public IGenericParameter DecodeGenericParameterDefinition(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
IGenericParameter | A decoded generic parameter. |
DecodeInstructionProtoype(LNode)
Decodes an LNode as an instruction prototype.
Declaration
public InstructionPrototype DecodeInstructionProtoype(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
InstructionPrototype | A decoded instruction prototype. |
DecodeInt32(LNode)
Decodes an LNode as a 32-bit signed integer constant.
Declaration
public int DecodeInt32(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer. |
DecodeMethod(LNode)
Decodes an LNode as a method reference.
Declaration
public IMethod DecodeMethod(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
IMethod | A decoded method reference. |
DecodeMethodLookup(LNode)
Decodes an LNode as a method lookup strategy.
Declaration
public MethodLookup DecodeMethodLookup(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
MethodLookup | A method lookup strategy. |
DecodeParameter(LNode)
Decodes a parameter node.
Declaration
public Parameter DecodeParameter(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A parameter node to decode. |
Returns
Type | Description |
---|---|
Parameter | A decoded parameter. |
DecodeProperty(LNode)
Decodes an LNode as a property reference.
Declaration
public IProperty DecodeProperty(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
IProperty | A decoded property reference. |
DecodeQualifiedName(LNode)
Decodes an LNode as a qualified name. Logs an error if the decoding process fails.
Declaration
public QualifiedName DecodeQualifiedName(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A node to decode as a qualified name. |
Returns
Type | Description |
---|---|
QualifiedName | The name described by |
DecodeSimpleName(LNode)
Decodes an LNode as a simple name. Logs an error if the decoding process fails.
Declaration
public SimpleName DecodeSimpleName(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | A node to decode as a simple name. |
Returns
Type | Description |
---|---|
SimpleName | The name described by |
DecodeType(LNode)
Decodes an LNode as a type reference.
Declaration
public IType DecodeType(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
IType | A decoded type reference. |
DecodeTypeDefinition(LNode)
Decodes an LNode as a type definition.
Declaration
public IType DecodeTypeDefinition(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
IType | A decoded type definition. |
DecodeTypeMemberDefinition(LNode)
Decodes an LNode as a type member definition.
Declaration
public ITypeMember DecodeTypeMemberDefinition(LNode node)
Parameters
Type | Name | Description |
---|---|---|
Loyc.Syntax.LNode | node | The node to decode. |
Returns
Type | Description |
---|---|
ITypeMember | A decoded type member definition. |
WithScope(TypeParent)
Creates a new decoder state that is identical to this decoder state in every way except for the decoding scope.
Declaration
public DecoderState WithScope(TypeParent newScope)
Parameters
Type | Name | Description |
---|---|---|
TypeParent | newScope | The decoding scope for the new decoder state. |
Returns
Type | Description |
---|---|
DecoderState | A new decoder state. |