Skip to content

Commit ca4a2b1

Browse files
author
Quoc Truong
committed
Add a check to prevent crash in variable analysis
1 parent 11227b3 commit ca4a2b1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Engine/VariableAnalysis.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ public void AnalyzeImpl(Ast ast, VariableAnalysis outerAnalysis)
197197
{
198198
var assignTarget = new AssignmentTarget(details.RealName, details.Type);
199199
assignTarget.Constant = details.Constant;
200+
if (!_variables.ContainsKey(assignTarget.Name))
201+
{
202+
_variables.Add(assignTarget.Name, new VariableAnalysisDetails
203+
{
204+
Name = assignTarget.Name,
205+
RealName = assignTarget.Name,
206+
Type = assignTarget.Type
207+
});
208+
}
200209
Entry.AddFirstAst(assignTarget);
201210
}
202211
}

0 commit comments

Comments
 (0)