ItsDeltin / Overwatch-Script-To-Workshop

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

Can't create objects directly in rules. #92

Closed nathan130200 closed 4 years ago

nathan130200 commented 4 years ago

Version: 1.0 pre-release 1 OS: Win10, x64

Code:

import "!PathfindEditor.del";

Details:

An exception was thrown while parsing.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Deltin.Deltinteger.Parse.CreateObjectAction..ctor(ParseInfo parseInfo, Scope scope, Create_objectContext context) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\CreateObjectAction.cs:line 50
   at Deltin.Deltinteger.Parse.DeltinScript.GetExpression(ParseInfo parseInfo, Scope scope, ExprContext exprContext, Boolean selfContained, Boolean usedAsValue, Scope getter) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\Translate.cs:line 344
   at Deltin.Deltinteger.Parse.OverloadChooser.SetContext(Call_parametersContext context) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\Parameter.cs:line 191
   at Deltin.Deltinteger.Parse.CallMethodAction..ctor(ParseInfo parseInfo, Scope scope, MethodContext methodContext, Boolean usedAsExpression, Scope getter) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\CallMethod.cs:line 55
   at Deltin.Deltinteger.Parse.DeltinScript.GetExpression(ParseInfo parseInfo, Scope scope, ExprContext exprContext, Boolean selfContained, Boolean usedAsValue, Scope getter) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\Translate.cs:line 344
   at Deltin.Deltinteger.Parse.SetVariableAction..ctor(ParseInfo parseInfo, Scope scope, VarsetContext varsetContext) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\SetVariable.cs:line 61
   at Deltin.Deltinteger.Parse.DeltinScript.GetStatement(ParseInfo parseInfo, Scope scope, StatementContext statementContext) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\Translate.cs:line 311
   at Deltin.Deltinteger.Parse.BlockAction..ctor(ParseInfo parseInfo, Scope scope, BlockContext blockContext) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\Block.cs:line 18
   at Deltin.Deltinteger.Parse.RuleAction..ctor(ParseInfo parseInfo, Scope scope, Ow_ruleContext ruleContext) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\RuleAction.cs:line 38
   at Deltin.Deltinteger.Parse.DeltinScript.Translate() in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\Translate.cs:line 192
   at Deltin.Deltinteger.Parse.DeltinScript..ctor(FileGetter fileGetter, Diagnostics diagnostics, ScriptFile rootRuleset, Func`2 addRules) in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Parse\Translate.cs:line 47
   at Deltin.Deltinteger.LanguageServer.DocumentHandler.Update() in C:\Users\Deltin\Documents\GitHub\Overwatch-Script-To-Workshop\Deltinteger\Deltinteger\Language Server\DocumentHandler.cs:line 178
ItsDeltin commented 4 years ago

The null reference is from creating object directly in rules. A workaround would be to create a method that will create the object.

ItsDeltin commented 4 years ago

Updated last release to include the fix.