diff --git a/RuriLib/Models/Blocks/Custom/HttpRequestBlockInstance.cs b/RuriLib/Models/Blocks/Custom/HttpRequestBlockInstance.cs index 165fbafc6..4179b9abe 100644 --- a/RuriLib/Models/Blocks/Custom/HttpRequestBlockInstance.cs +++ b/RuriLib/Models/Blocks/Custom/HttpRequestBlockInstance.cs @@ -52,6 +52,11 @@ public override string ToLC(bool printDefaultParams = false) using var writer = new LoliCodeWriter(base.ToLC(printDefaultParams)); + if (Safe) + { + writer.AppendLine("SAFE", 2); + } + switch (RequestParams) { case StandardRequestParams x: @@ -154,6 +159,12 @@ public override void FromLC(ref string script, ref int lineNumber) if (string.IsNullOrWhiteSpace(line)) continue; + if (line.StartsWith("SAFE")) + { + Safe = true; + continue; + } + if (line.StartsWith("TYPE:")) { try diff --git a/RuriLib/Models/Blocks/Custom/ParseBlockInstance.cs b/RuriLib/Models/Blocks/Custom/ParseBlockInstance.cs index 8260d92ba..01519b11f 100644 --- a/RuriLib/Models/Blocks/Custom/ParseBlockInstance.cs +++ b/RuriLib/Models/Blocks/Custom/ParseBlockInstance.cs @@ -45,7 +45,12 @@ public override string ToLC(bool printDefaultParams = false) */ using var writer = new LoliCodeWriter(base.ToLC(printDefaultParams)); - + + if (Safe) + { + writer.AppendLine("SAFE", 2); + } + if (Recursive) writer.AppendLine("RECURSIVE", 2); @@ -84,6 +89,12 @@ public override void FromLC(ref string script, ref int lineNumber) if (string.IsNullOrWhiteSpace(line)) continue; + if (line.StartsWith("SAFE")) + { + Safe = true; + continue; + } + if (line.StartsWith("RECURSIVE")) Recursive = true; @@ -148,10 +159,7 @@ public override string ToCSharp(List definedVariables, ConfigSettings se writer.WriteLine("try {"); // Here we already know the variable exists so we just do the assignment - if (Descriptor.ReturnType.HasValue) - { - writer.Write($"{OutputVariable} = "); - } + writer.Write($"{OutputVariable} = "); WriteParseMethod(writer);