public override bool Walk(AssignmentStatement node) { PythonLocalVariableAssignment localVariableAssignment = new PythonLocalVariableAssignment(node); if (localVariableAssignment.IsLocalVariableAssignment()) { if (localVariableAssignment.VariableName == variableName) { typeName = localVariableAssignment.TypeName; } } return base.Walk(node); }
public override bool Walk(AssignmentStatement node) { PythonLocalVariableAssignment localVariableAssignment = new PythonLocalVariableAssignment(node); if (localVariableAssignment.IsLocalVariableAssignment()) { if (localVariableAssignment.VariableName == variableName) { typeName = localVariableAssignment.TypeName; } } return(base.Walk(node)); }
public void TypeName_CallExpressionTargetIsNotNameOrMemberExpression_ReturnsEmptyStringAndDoesNotGetStuckInInfiniteLoop() { string code = "a = 2"; AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement(code); Expression constantExpression = statement.Right; CallExpression callExpression = new CallExpression(constantExpression, new Arg[0]); List<Expression> expressions = new List<Expression>(statement.Left); statement = new AssignmentStatement(expressions.ToArray(), callExpression); PythonLocalVariableAssignment localVariableAssignment = new PythonLocalVariableAssignment(statement); string typeName = localVariableAssignment.TypeName; Assert.AreEqual(String.Empty, typeName); }