Code structure improvements

This commit is contained in:
Stone_Red
2022-03-10 12:43:22 +01:00
parent c02104db5a
commit 83f99d4dd5
8 changed files with 26 additions and 379 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ namespace YesNt.Interpreter.Runtime
{
public int CallerLine { get; }
public Dictionary<string, string> Variables { get; } = new();
public Stack<string> Arguemtns { get; } = new();
public Stack<string> Arguemtns { get; }
public Stack<string> Results { get; } = new();
public FunctionScope(int callerLine, Stack<string> arguemtns)
@@ -91,7 +91,7 @@ namespace YesNt.Interpreter
{
if (IsTask)
{
parentRuntimeInformation.WriteLine(output.FromSaveString(), forceWrite);
parentRuntimeInformation!.WriteLine(output.FromSaveString(), forceWrite);
}
else
{
@@ -115,7 +115,7 @@ namespace YesNt.Interpreter
{
if (IsTask)
{
parentRuntimeInformation.Write(output.FromSaveString(), forceWrite);
parentRuntimeInformation!.Write(output.FromSaveString(), forceWrite);
}
else
{
@@ -133,10 +133,10 @@ namespace YesNt.Interpreter
if (!Stop)
{
Line line = Lines[Math.Min(LineNumber, Lines.Count - 1)];
WriteLine($"{Environment.NewLine}[{(IsTask ? $"Task: {TaskId}" : "The process")} was terminated at line {line.LineNumber + 1} in the file \"{line.FileName}\" with the message: {message}]", true);
WriteLine($"{Environment.NewLine}[{(IsTask ? $"Task {TaskId}" : "The process")} was terminated at line {line.LineNumber + 1} in the file \"{line.FileName}\" with the message: {message}]", true);
Stop = true;
}
if (stopAllTasks == true && StopAllTasks == false)
if (stopAllTasks && !StopAllTasks)
{
StopAllTasks = true;
OnExit?.Invoke(message, StopAllTasks);
@@ -176,7 +176,9 @@ namespace YesNt.Interpreter
InternalIsInFunction = false;
LineNumber = 0;
taskId = internalTaskId + 1;
#pragma warning disable S2696 // Instance members should not write to "static" fields
internalTaskId++;
#pragma warning restore S2696 // Instance members should not write to "static" fields
}
}
}
@@ -142,7 +142,7 @@ namespace YesNt.Interpreter
foreach (KeyValuePair<StaticStatementAttribute, Action> staticStatement in staticStatements)
{
StaticStatementAttribute staticStatementAttribute = staticStatement.Key;
if (staticStatementAttribute.ExecuteInSearchLabelMode == false && runtimeInfo.IsSearching)
if (!staticStatementAttribute.ExecuteInSearchLabelMode && runtimeInfo.IsSearching)
{
continue;
}
@@ -157,7 +157,7 @@ namespace YesNt.Interpreter
{
StatementAttribute statementAttribute = statement.Key;
if (statementAttribute.ExecuteInSearchMode == false && runtimeInfo.IsSearching)
if (!statementAttribute.ExecuteInSearchMode && runtimeInfo.IsSearching)
{
statementFound = true;
continue;
@@ -227,7 +227,7 @@ namespace YesNt.Interpreter
}
}
if (runtimeInfo.Stop == false)
if (!runtimeInfo.Stop)
{
if (!string.IsNullOrWhiteSpace(runtimeInfo.SearchLabel))
{