From d9ab438de2e6e66d3e10d0d398642b313c169afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20M=C3=AD=C5=A1ek?= Date: Sun, 30 Dec 2018 17:09:30 +0100 Subject: [PATCH] dereferencing fix --- src/Peachpie.CodeAnalysis/FlowAnalysis/ExpressionAnalysis.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Peachpie.CodeAnalysis/FlowAnalysis/ExpressionAnalysis.cs b/src/Peachpie.CodeAnalysis/FlowAnalysis/ExpressionAnalysis.cs index 571cb38e9f..8b1867809e 100644 --- a/src/Peachpie.CodeAnalysis/FlowAnalysis/ExpressionAnalysis.cs +++ b/src/Peachpie.CodeAnalysis/FlowAnalysis/ExpressionAnalysis.cs @@ -347,6 +347,7 @@ protected virtual void VisitLocalVariableRef(BoundVariableRef x, VariableHandle { // in global code, treat the variable as initialized always: State.SetVarInitialized(local); + vartype.IsRef = true; // variable might be a reference } } @@ -460,7 +461,7 @@ public override T VisitVariableRef(BoundVariableRef x) if (x.Access.IsRead) { State.FlowContext.SetAllUsed(); - x.TypeRefMask = TypeRefMask.AnyType; + x.TypeRefMask = TypeRefMask.AnyType.WithRefFlag; } if (x.Access.IsWrite || x.Access.IsEnsure)