-
-
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.
- Loading branch information
Showing
16 changed files
with
97 additions
and
84 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
NewSource/Socordia.CodeAnalysis/AST/Declarations/Types/StructDeclaration.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,10 @@ | ||
using Socordia.CodeAnalysis.AST.TypeNames; | ||
|
||
namespace Socordia.CodeAnalysis.AST.Declarations; | ||
|
||
public class StructDeclaration( | ||
string name, | ||
TypeName? baseType, | ||
List<TypeName> inheritances, | ||
List<TypeMemberDeclaration> members) | ||
: ClassDeclaration(name, baseType, inheritances, members); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 0 additions & 25 deletions
25
NewSource/Socordia.CodeAnalysis/Parsing/ParsePoints/Declarations/Types/StructDeclaration.cs
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...e/Socordia.CodeAnalysis/Parsing/ParsePoints/Declarations/Types/StructDeclarationParser.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 Socordia.CodeAnalysis.AST; | ||
using Socordia.CodeAnalysis.AST.Declarations; | ||
using Socordia.CodeAnalysis.Core; | ||
|
||
namespace Socordia.CodeAnalysis.Parsing.ParsePoints.Declarations; | ||
|
||
public sealed class StructDeclarationParser : IParsePoint | ||
{ | ||
public static AstNode Parse(TokenIterator iterator, Parser parser) | ||
{ | ||
var keywordToken = iterator.Prev; | ||
|
||
var nameToken = iterator.Match(TokenType.Identifier); | ||
var members = ParsingHelpers.ParseDeclarationMembers<TypeMemberDeclaration>(parser); | ||
|
||
return new StructDeclaration(nameToken.Text, null, [], members); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Reflection; | ||
using MrKWatkins.Ast.Listening; | ||
using Socordia.CodeAnalysis.AST; | ||
using Socordia.CodeAnalysis.AST.Declarations; | ||
|
||
namespace SocordiaC.Compilation; | ||
|
||
public class CollectStructsListener : Listener<Driver, AstNode, StructDeclaration> | ||
{ | ||
protected override void ListenToNode(Driver context, StructDeclaration node) | ||
{ | ||
var ns = context.GetNamespaceOf(node); | ||
var type = context.Compilation.Module.CreateType(ns, node.Name, | ||
Utils.GetTypeModifiers(node) | TypeAttributes.Sealed | TypeAttributes.SequentialLayout, | ||
context.Compilation.Resolver.SysTypes.ValueType); | ||
} | ||
|
||
protected override bool ShouldListenToChildren(Driver context, AstNode node) => false; | ||
} |
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