ItsDeltin / Overwatch-Script-To-Workshop

Converts scripts to Overwatch workshops.
207 stars 24 forks source link

Bug: Exception when using virtual void methods #425

Closed badcodecat closed 1 year ago

badcodecat commented 1 year ago

When a method is virtual and the return type is void the compiler fails. Might be related to #418 or the associated fix. Example code to reproduce:

class Foo
{
    public virtual void void_method()
    {
    }
}

rule: "Test"
{
    Foo foo = new Foo();
    foo.void_method();
}

Output (error):

An exception was thrown while translating to workshop.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Deltin.Deltinteger.Parse.ReturnHandler.GetReturnedValue() in /home/runner/work/Overwatch-Script-To-Workshop/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Parse/Functions/ReturnHandler.cs:line 76
   at Deltin.Deltinteger.Parse.ExpressionTree.ParseTree(ActionSet actionSet, Boolean expectingValue) in /home/runner/work/Overwatch-Script-To-Workshop/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Parse/ExpressionTree.cs:line 211
   at Deltin.Deltinteger.Parse.ExpressionTree.Translate(ActionSet actionSet) in /home/runner/work/Overwatch-Script-To-Workshop/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Parse/ExpressionTree.cs:line 171
   at Deltin.Deltinteger.Parse.BlockAction.Translate(ActionSet actionSet) in /home/runner/work/Overwatch-Script-To-Workshop/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Parse/Block.cs:line 36
   at Deltin.Deltinteger.Parse.DeltinScript.ToWorkshop(Func`2 addRules) in /home/runner/work/Overwatch-Script-To-Workshop/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Parse/Translate.cs:line 260
   at Deltin.Deltinteger.Parse.DeltinScript..ctor(TranslateSettings translateSettings) in /home/runner/work/Overwatch-Script-To-Workshop/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Parse/Translate.cs:line 57