public static Fragment ParameterFragmentIntersection(MethodCall methodCall, ISymbolTable context)
 {
     Fragment current = context.InferFragmentType (methodCall.Operands[0]);
       Fragment intersection = current;
       for (int i = 1; i < methodCall.Operands.Count; i++)
       {
     Fragment next = context.InferFragmentType (methodCall.Operands[i]);
     intersection = FragmentIntersection (current, next);
       }
       return intersection;
 }
Esempio n. 2
0
        public static Fragment ParameterFragmentIntersection(MethodCall methodCall, ISymbolTable context)
        {
            Fragment current      = context.InferFragmentType(methodCall.Operands[0]);
            Fragment intersection = current;

            for (int i = 1; i < methodCall.Operands.Count; i++)
            {
                Fragment next = context.InferFragmentType(methodCall.Operands[i]);
                intersection = FragmentIntersection(current, next);
            }
            return(intersection);
        }
Esempio n. 3
0
        private void CheckParameter(Expression operand, Fragment expectedFragment)
        {
            Fragment operandFragmentType = _symbolTable.InferFragmentType(operand);

            if (!FragmentUtility.FragmentTypesAssignable(operandFragmentType, expectedFragment))
            {
                ProblemMetadata problemMetadata = new ProblemMetadata(operand.UniqueKey, operand.SourceContext, expectedFragment, operandFragmentType);
                PassProblem(operand, problemMetadata);
            }
        }
Esempio n. 4
0
        private Fragment FirstOperandsFragmentType(AssignmentStatement assignment, HandleContext context)
        {
            Fragment   fragmentType = Fragment.CreateEmpty();
            Expression firstOperand = FirstOperand(assignment.Source);

            if (firstOperand != null)
            {
                ISymbolTable symbolTable = context.SymbolTable;
                fragmentType = symbolTable.InferFragmentType(firstOperand);
            }
            return(fragmentType);
        }
        private void CheckAssignment(AssignmentStatement assignmentStatement, string targetName, HandleContext context)
        {
            ISymbolTable symbolTable        = context.SymbolTable;
            Fragment     targetFragmentType = symbolTable.GetFragmentType(targetName);
            Fragment     sourceFragmentType = symbolTable.InferFragmentType(assignmentStatement.Source);

            if (targetFragmentType != sourceFragmentType)
            {
                symbolTable.MakeUnsafe(targetName);
            }
            else
            {
                SetPreConditionForIndexerObject(assignmentStatement, targetName, sourceFragmentType, context);
            }
        }
        private void InferArrayFragment(AssignmentStatement assignmentStatement, string targetName, HandleContext context)
        {
            ISymbolTable symbolTable        = context.SymbolTable;
            Fragment     targetFragmentType = symbolTable.InferFragmentType(assignmentStatement.Source);

            if (context.ArrayFragmentTypeDefined[targetName] == false)
            {
                symbolTable.MakeSafe(targetName, targetFragmentType);
                context.ArrayFragmentTypeDefined[targetName] = true;
            }
            else if (symbolTable.GetFragmentType(targetName) == Fragment.CreateLiteral())
            {
                symbolTable.MakeSafe(targetName, targetFragmentType);
            }
            else if (symbolTable.GetFragmentType(targetName) != targetFragmentType && targetFragmentType != Fragment.CreateLiteral())
            {
                symbolTable.MakeUnsafe(targetName);
            }
        }