@@ -64,8 +64,10 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
6464 val lhsAst = astForNode(dictElement.key)
6565 val rhsAst = astForNode(dictElement.value)
6666
67- val lhsTmpNode = Ast (identifierNode(dictElement, tmpName))
68- val lhsIndexAccessCallAst = createIndexAccessCallAst(dictElement, lhsTmpNode, lhsAst)
67+ val lhsTmpNode = identifierNode(dictElement, tmpName)
68+ scope.addVariableReference(tmpName, lhsTmpNode, Defines .Any , EvaluationStrategies .BY_REFERENCE )
69+
70+ val lhsIndexAccessCallAst = createIndexAccessCallAst(dictElement, Ast (lhsTmpNode), lhsAst)
6971
7072 createAssignmentCallAst(
7173 dictElement,
@@ -77,6 +79,7 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
7779 }
7880
7981 val tmpNode = identifierNode(node, tmpName)
82+ scope.addVariableReference(tmpName, tmpNode, Defines .Any , EvaluationStrategies .BY_REFERENCE )
8083
8184 scope.popScope()
8285 localAstParentStack.pop()
@@ -231,7 +234,7 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
231234 callAst(callNode_, args, Option (baseAst))
232235 }
233236
234- private def constructorInvocationBlockAst (expr : FunctionCallExprSyntax ): Ast = {
237+ private def astForConstructorInvocation (expr : FunctionCallExprSyntax ): Ast = {
235238 // get call is safe as this function is guarded by isRefToConstructor
236239 val tpe = fullnameProvider.typeFullname(expr).get
237240 registerType(tpe)
@@ -241,10 +244,13 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
241244 scope.pushNewBlockScope(blockNode_)
242245
243246 val tmpNodeName = scopeLocalUniqueName(" tmp" )
244- val tmpNode = identifierNode (expr, tmpNodeName, tmpNodeName, tpe)
245- val localTmpNode = localNode(expr, tmpNodeName, tmpNodeName, tpe )
247+ val localTmpNode = localNode (expr, tmpNodeName, tmpNodeName, tpe).order( 0 )
248+ diffGraph.addEdge(blockNode_, localTmpNode, EdgeTypes . AST )
246249 scope.addVariable(tmpNodeName, localTmpNode, tpe, VariableScopeManager .ScopeType .BlockScope )
247250
251+ val tmpNode = identifierNode(expr, tmpNodeName, tmpNodeName, tpe)
252+ scope.addVariableReference(tmpNodeName, tmpNode, tpe, EvaluationStrategies .BY_SHARING )
253+
248254 val allocOp = Operators .alloc
249255 val allocCallNode = callNode(expr, allocOp, allocOp, allocOp, DispatchTypes .STATIC_DISPATCH )
250256 val assignmentCallOp = Operators .assignment
@@ -274,10 +280,9 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
274280
275281 val retNode = identifierNode(expr, tmpNodeName, tmpNodeName, tpe)
276282 scope.addVariableReference(tmpNodeName, retNode, tpe, EvaluationStrategies .BY_SHARING )
277- val retAst = Ast (retNode)
278283
279284 scope.popScope()
280- Ast (blockNode_).withChildren(Seq (assignmentAst, constructorCallAst, retAst ))
285+ Ast (blockNode_).withChildren(Seq (assignmentAst, constructorCallAst, Ast (retNode) ))
281286 }
282287
283288 private def astForFunctionCallExprSyntax (node : FunctionCallExprSyntax ): Ast = {
@@ -299,7 +304,7 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
299304 val memberCode = code(m.declName)
300305 handleCallNodeArgs(node, astForNode(m.base.get), memberCode)
301306 case other if isRefToConstructor(node, other) =>
302- constructorInvocationBlockAst (node)
307+ astForConstructorInvocation (node)
303308 case other if isRefToClosure(node, other) =>
304309 astForClosureCall(node)
305310 case declReferenceExprSyntax : DeclReferenceExprSyntax if code(declReferenceExprSyntax) != " self" =>
0 commit comments