public List <RelationalExpression> GetInitializationRelations(CLanguageParser.FunctionDefinitionContext context) { var relations = context .GetDescendants <CLanguageParser.InitDeclaratorContext>() .Where(x => x.ChildCount > 1) .Select(GetRelationalExpression) .ToList(); return(relations); }
public List <RelationalExpression> GetConditionRelations(CLanguageParser.FunctionDefinitionContext context) { var relations = context .GetDescendants <CLanguageParser.SelectionStatementContext>() .SelectMany(x => x.expression().GetLeafDescendants <CLanguageParser.EqualityExpressionContext>()) .Select(x => (object)x.Parent) .Select(GetRelationalExpression) .ToList(); return(relations); }
public List <RelationalExpression> GetAssignmentRelations(CLanguageParser.FunctionDefinitionContext context) { var relations = context .GetDescendants <CLanguageParser.AssignmentExpressionContext>() .Where(x => x.ChildCount > 1) .Select(GetRelationalExpression) .ToList(); foreach (var relation in relations) { //todo: this is incorrect since we need to track only those relations from the root to this relation; //todo "if (condition) {1} else {2;3}" => for relation "3" we don't track relation "1" relation.PreviousRelations = relations .Where(x => x.LeftOperandSnapshot != null || x.RightOperandSnapshot != null) .Where(x => x.RightOperandInterval.End <= relation.LeftOperandInterval.Start) .ToList(); } return(relations); }