Skip to content

Commit

Permalink
#31 - End is property
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepami committed Jul 26, 2024
1 parent 12ed0d5 commit 61cbf6e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/HydraScript.Lib/BackEnd/Instructions/Halt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace HydraScript.Lib.BackEnd.Instructions;

public class Halt : Instruction
{
public override bool End() => true;
public override bool End => true;

public override IAddress Execute(VirtualMachine vm)
{
Expand Down
2 changes: 1 addition & 1 deletion src/HydraScript.Lib/BackEnd/Instructions/Instruction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected virtual void OnSetOfAddress(IAddress address) { }

public abstract IAddress Execute(VirtualMachine vm);

public virtual bool End() => false;
public virtual bool End => false;

protected abstract string ToStringInternal();

Expand Down
2 changes: 1 addition & 1 deletion src/HydraScript.Lib/BackEnd/VirtualMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Run(AddressedInstructions instructions)
Frames.Push(new Frame(instructions.Start));

var address = instructions.Start;
while (!instructions[address].End())
while (!instructions[address].End)
{
var instruction = instructions[address];
var jump = instruction.Execute(this);
Expand Down
2 changes: 1 addition & 1 deletion tests/HydraScript.Tests/Helpers/MockExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static Mock<Halt> Trackable(this Mock<Halt> halt)
{
halt.Setup(x => x.Execute(It.IsAny<VirtualMachine>()))
.Returns(new HashAddress(seed: 0)).Verifiable();
halt.Setup(x => x.End()).Returns(true);
halt.Setup(x => x.End).Returns(true);
return halt;
}

Expand Down

0 comments on commit 61cbf6e

Please sign in to comment.