-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API: added field declaration nodes. Fixed #86.
- Loading branch information
1 parent
a657c63
commit 193000c
Showing
21 changed files
with
145 additions
and
180 deletions.
There are no files selected for viewing
32 changes: 0 additions & 32 deletions
32
src/Crosslight.API/Nodes/Implementations/Access/ConstantNode.cs
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
src/Crosslight.API/Nodes/Implementations/Access/FieldNode.cs
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
src/Crosslight.API/Nodes/Implementations/Access/LiteralNode.cs
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/Crosslight.API/Nodes/Implementations/Access/ValueNode.cs
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
src/Crosslight.API/Nodes/Implementations/Access/VariableDeclarationNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Crosslight.API.Nodes.Implementations.Expressions; | ||
using Crosslight.API.Nodes.Interfaces; | ||
using Crosslight.API.Util; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Crosslight.API.Nodes.Implementations.Access | ||
{ | ||
public class VariableDeclarationNode : Node, IIdentifierProvider | ||
{ | ||
public override string Type => nameof(VariableDeclarationNode); | ||
|
||
public string Identifier { get; } | ||
public SyncedProperty<ExpressionNode, Node> Initializer { get; protected set; } | ||
// TODO: c# also has bracketed argument list | ||
// public unsafe fixed byte bs[7]; | ||
public VariableDeclarationNode(string identifier) | ||
{ | ||
Identifier = identifier; | ||
Initializer = new SyncedProperty<ExpressionNode, Node>(Children); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return Type; | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Crosslight.API/Nodes/Implementations/Access/VariableListDeclarationNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Crosslight.API.Nodes.Implementations.Expressions.Types; | ||
using Crosslight.API.Nodes.Interfaces; | ||
using Crosslight.API.Util; | ||
|
||
namespace Crosslight.API.Nodes.Implementations.Access | ||
{ | ||
/// <summary> | ||
/// <see cref="VariableListDeclarationNode"/> represents the variable abstraction in the language. | ||
/// It can declare one or more actual variables of a common type. | ||
/// </summary> | ||
public class VariableListDeclarationNode : Node | ||
{ | ||
public override string Type => nameof(VariableListDeclarationNode); | ||
|
||
public SyncedProperty<TypeReferenceNode, Node> DeclarationType { get; protected set; } | ||
public SyncedList<VariableDeclarationNode, Node> Variables { get; protected set; } | ||
public VariableListDeclarationNode() | ||
{ | ||
DeclarationType = new SyncedProperty<TypeReferenceNode, Node>(Children); | ||
Variables = new SyncedList<VariableDeclarationNode, Node>(Children); | ||
} | ||
public override string ToString() | ||
{ | ||
return Type; | ||
} | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
src/Crosslight.API/Nodes/Implementations/Access/VariableNode.cs
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
src/Crosslight.API/Nodes/Implementations/Entities/Fields/BaseFieldDeclarationNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Crosslight.API.Nodes.Implementations.Access; | ||
using Crosslight.API.Nodes.Implementations.Access.Modifiers; | ||
using Crosslight.API.Nodes.Implementations.Entities; | ||
using Crosslight.API.Nodes.Interfaces; | ||
using Crosslight.API.Nodes.Interfaces.Access; | ||
using Crosslight.API.Nodes.Interfaces.Access.Modifiers; | ||
using Crosslight.API.Util; | ||
using System; | ||
|
||
namespace Crosslight.API.Nodes.Implementations.Entities.Fields | ||
{ | ||
/// <summary> | ||
/// <see cref="BaseFieldDeclarationNode"/> represents the field abstraction in the language. | ||
/// </summary> | ||
public abstract class BaseFieldDeclarationNode : MemberDeclarationNode, IAttributesProvider, IModifiersProvider | ||
{ | ||
public override string Type => nameof(BaseFieldDeclarationNode); | ||
|
||
public SyncedProperty<VariableListDeclarationNode, Node> Declaration { get; protected set; } | ||
public BaseFieldDeclarationNode() | ||
{ | ||
Declaration = new SyncedProperty<VariableListDeclarationNode, Node>(Children); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return Type; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Crosslight.API/Nodes/Implementations/Entities/Fields/EventFieldDeclarationNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Crosslight.API.Nodes.Interfaces.Access; | ||
using Crosslight.API.Nodes.Interfaces.Access.Modifiers; | ||
|
||
namespace Crosslight.API.Nodes.Implementations.Entities.Fields | ||
{ | ||
/// <summary> | ||
/// <see cref="EventFieldDeclarationNode"/> represents an event field declaration. | ||
/// </summary> | ||
public class EventFieldDeclarationNode : BaseFieldDeclarationNode, IAttributesProvider, IModifiersProvider | ||
{ | ||
public override string Type => nameof(EventFieldDeclarationNode); | ||
|
||
public override string ToString() | ||
{ | ||
return Type; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Crosslight.API/Nodes/Implementations/Entities/Fields/FieldDeclarationNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Crosslight.API.Nodes.Interfaces.Access; | ||
using Crosslight.API.Nodes.Interfaces.Access.Modifiers; | ||
|
||
namespace Crosslight.API.Nodes.Implementations.Entities.Fields | ||
{ | ||
/// <summary> | ||
/// <see cref="FieldDeclarationNode"/> represents a field declaration. | ||
/// </summary> | ||
public class FieldDeclarationNode : BaseFieldDeclarationNode, IAttributesProvider, IModifiersProvider | ||
{ | ||
public override string Type => nameof(FieldDeclarationNode); | ||
|
||
public override string ToString() | ||
{ | ||
return Type; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Crosslight.API/Nodes/Implementations/Expressions/Types/TypeReferenceNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Crosslight.API.Nodes.Implementations.Expressions.Types | ||
{ | ||
public abstract class TypeReferenceNode : Node // TODO: inheritance | ||
{ | ||
public override string Type => nameof(TypeReferenceNode); | ||
public override string ToString() | ||
{ | ||
return Type; | ||
} | ||
} | ||
} |
Oops, something went wrong.