Skip to content

Commit

Permalink
Merge pull request #35 from phantasma-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Relfos authored Aug 5, 2023
2 parents ee20d6c + 5e325d4 commit 244795e
Show file tree
Hide file tree
Showing 40 changed files with 1,767 additions and 1,492 deletions.
2 changes: 1 addition & 1 deletion Compiler/Properties/PublishProfiles/FolderProfile.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Platform>Any CPU</Platform>
<PublishDir>C:\Code\TOMB\Publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
4 changes: 0 additions & 4 deletions Compiler/TombCompiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Phantasma.Business" Version="1.0.7" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Library\src\TOMBLib.csproj" />
</ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions Library/src/AST/Declarations/EventDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
using Phantasma.Business.Blockchain;
using Phantasma.Business.CodeGen.Assembler;
using Phantasma.Business.Blockchain.VM;
using Phantasma.Core.Domain.VM;
using Phantasma.Core.Domain.Interfaces;
using Phantasma.Core.Domain.Token.Structs;
using Phantasma.Core.Cryptography.Structs;
using Phantasma.Core.Domain.Token.Enums;
using Phantasma.Core.Domain.Contract;
using Phantasma.Core.Domain.VM.Enums;
using Phantasma.Core.Domain.Events.Structs;
using Phantasma.Core.Domain.Execution.Enums;

namespace Phantasma.Tomb.AST.Declarations
{
Expand Down
1 change: 1 addition & 0 deletions Library/src/AST/Declarations/LibraryDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Phantasma.Core.Domain;
using Phantasma.Core.Domain.Validation;
using Phantasma.Tomb.CodeGen;

namespace Phantasma.Tomb.AST.Declarations
Expand Down
3 changes: 3 additions & 0 deletions Library/src/AST/Declarations/MethodDeclaration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Phantasma.Core.Domain;
using Phantasma.Core.Domain.Contract;
using Phantasma.Core.Domain.Contract.Structs;
using Phantasma.Core.Domain.VM.Enums;
using Phantasma.Tomb.AST.Statements;
using Phantasma.Tomb.CodeGen;

Expand Down
10 changes: 9 additions & 1 deletion Library/src/AST/Expressions/ArrayElementExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ public override Register GenerateCode(CodeGenerator output)
var dstReg = Compiler.Instance.AllocRegister(output, this);
var idxReg = indexExpression.GenerateCode(output);

output.AppendLine(this, $"GET {decl.Register} {dstReg} {idxReg}");
var reg = decl.Register;
output.AppendLine(this, $"GET {reg} {dstReg} {idxReg}");

var arrayType = decl.Type as ArrayVarType;
if (arrayType == null)
{
throw new CompilerException(this, $"expected array type:" + decl.Name);
}
this.CallNecessaryConstructors(output, arrayType.elementType, decl.Register);

Compiler.Instance.DeallocRegister(ref idxReg);

Expand Down
1 change: 1 addition & 0 deletions Library/src/AST/Expressions/BinaryExpression.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Phantasma.Core.Domain;
using Phantasma.Core.Domain.VM.Enums;
using Phantasma.Tomb.CodeGen;

using System;
Expand Down
1 change: 1 addition & 0 deletions Library/src/AST/Expressions/MacroExpression.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Phantasma.Core.Domain;
using Phantasma.Core.Domain.Contract;
using Phantasma.Core.Numerics;
using Phantasma.Tomb.CodeGen;

Expand Down
1 change: 1 addition & 0 deletions Library/src/AST/MethodInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Phantasma.Tomb.AST.Expressions;
using Phantasma.Tomb.AST.Declarations;
using Phantasma.Core.Domain;
using Phantasma.Core.Domain.VM.Enums;

namespace Phantasma.Tomb.AST
{
Expand Down
3 changes: 3 additions & 0 deletions Library/src/CodeGen/Contract.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Phantasma.Business.VM;
using Phantasma.Core.Domain;
using Phantasma.Core.Domain.Contract;
using Phantasma.Core.Domain.Validation;
using Phantasma.Core.Domain.VM.Structs;
using Phantasma.Tomb.AST;
using Phantasma.Tomb.AST.Declarations;
using Phantasma.Tomb.AST.Expressions;
Expand Down
759 changes: 759 additions & 0 deletions Library/src/CodeGen/Libraries.cs

Large diffs are not rendered by default.

Loading

0 comments on commit 244795e

Please sign in to comment.