port from perforce
This commit is contained in:
24
intromat/Intromat/Model/LocalVariableDefinition.cs
Normal file
24
intromat/Intromat/Model/LocalVariableDefinition.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using Intromat.Model.Compiler;
|
||||
|
||||
namespace Intromat.Model
|
||||
{
|
||||
public class LocalVariableDefinition<T> : ITypedVariableDefinition<T>
|
||||
{
|
||||
public string? Value { get; set; }
|
||||
public string? VariableName { get; private set; }
|
||||
|
||||
public void Compile(CompilerContext context, StringBuilder sb)
|
||||
{
|
||||
VariableName = context.FindFreeVariableName();
|
||||
context.AddVariableToCurrentScope(this);
|
||||
Debug.Assert(Value != null, nameof(Value) + " != null");
|
||||
sb.Append($"local {VariableName} = {Value}\n");
|
||||
}
|
||||
|
||||
public void CompileHeader(CompilerContext context, StringBuilder sb)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user