Class DeriveSymTypeOfBSCommonExpressions

    • Constructor Detail

      • DeriveSymTypeOfBSCommonExpressions

        public DeriveSymTypeOfBSCommonExpressions()
        Deprecated.
    • Method Detail

      • setSubExprNameExtractor

        public void setSubExprNameExtractor​(SubExprNameExtractor subExprNameExtractor)
        Deprecated.
      • setDefiningSymbolSetter

        public void setDefiningSymbolSetter​(DefiningSymbolSetter definingSymboLSetter)
        Deprecated.
      • numericPrefix

        protected SymTypeExpression numericPrefix​(ASTExpression expr,
                                                  java.lang.String op,
                                                  de.se_rwth.commons.SourcePosition pos)
        Deprecated.
      • traverse

        public void traverse​(ASTPlusExpression expr)
        Deprecated.
        We use traverse to collect the results of the two parts of the expression and calculate the result for the whole expression
        Specified by:
        traverse in interface CommonExpressionsHandler
      • traverse

        public void traverse​(ASTMultExpression expr)
        Deprecated.
        We use traverse to collect the results of the two parts of the expression and calculate the result for the whole expression
        Specified by:
        traverse in interface CommonExpressionsHandler
      • traverse

        public void traverse​(ASTDivideExpression expr)
        Deprecated.
        We use traverse to collect the results of the two parts of the expression and calculate the result for the whole expression
        Specified by:
        traverse in interface CommonExpressionsHandler
      • traverse

        public void traverse​(ASTMinusExpression expr)
        Deprecated.
        We use traverse to collect the results of the two parts of the expression and calculate the result for the whole expression
        Specified by:
        traverse in interface CommonExpressionsHandler
      • traverse

        public void traverse​(ASTModuloExpression expr)
        Deprecated.
        We use traverse to collect the results of the two parts of the expression and calculate the result for the whole expression
        Specified by:
        traverse in interface CommonExpressionsHandler
      • traverse

        public void traverse​(ASTEqualsExpression expr)
        Deprecated.
        We use traverse to collect the results of the two parts of the expression and calculate the result for the whole expression
        Specified by:
        traverse in interface CommonExpressionsHandler
      • calculateNamingChainFieldAccess

        protected void calculateNamingChainFieldAccess​(ASTFieldAccessExpression expr,
                                                       java.util.List<ExprToNamePair> nameParts)
        Deprecated.
        Calculate the type result of FieldAccessExpressions that represent qualified names and cascading field accesses. E.g., pac.kage.Type.staticMember, or, localField.innerField.furtherNestedField. But not: pac.kage.Type.staticMethod().innerField, as here innerField is not only qualified by names, but it is based on the access of a value returned by a CallExpression.
        Parameters:
        expr - The only valid sub expressions of the FieldAccessExpression are other FieldAccessExpressions, and a ASTNameExpression that is the end of the field access chain.
      • calculateArithmeticFieldAccessExpression

        protected void calculateArithmeticFieldAccessExpression​(ASTFieldAccessExpression expr)
        Deprecated.
        Calculate the type result of FieldAccessExpressions that do not represent qualified names. (E.g. `new Foo().bar`)
      • calculateFieldAccess

        protected void calculateFieldAccess​(ASTFieldAccessExpression expr,
                                            boolean quiet)
        Deprecated.
        Calculates the type result of the field access expression, given that the type result of the accessed entity's owner has already been computed (and is accessible via getTypeCheckResult()).
        Parameters:
        quiet - Prevents the logging of errors if no entity is found that could be accessed, i.e., if the field access is invalid and the calculation of a result is not possible.
      • getCorrectFieldsFromInnerType

        protected java.util.List<VariableSymbol> getCorrectFieldsFromInnerType​(SymTypeExpression innerResult,
                                                                               ASTFieldAccessExpression expr)
        Deprecated.
        Hookpoint for object oriented languages to get the correct variables/fields from a type based on their modifiers
      • checkModifierType

        protected boolean checkModifierType​(TypeSymbol typeSymbol)
        Deprecated.
        Hookpoint for object oriented languages that offer modifiers like static, public, private, ...
      • filterModifiersVariables

        protected java.util.List<VariableSymbol> filterModifiersVariables​(java.util.List<VariableSymbol> variableSymbols)
        Deprecated.
        Hookpoint for object oriented languages that offer modifiers like static, public, private, ...
      • calculatedQualifiedEntity

        protected void calculatedQualifiedEntity​(java.util.List<ExprToNamePair> nameParts)
        Deprecated.
        Tries to resolve the given name parts to a variable, type variable, or type and if a symbol is found, then it(s type) is set as the current type check result. If no symbol is found, then nothing happens (no error logged, no altering of the type check result). If multiple fields are found, then the result is set to obscure, and an error is logged. Variables take precedence over types variables that take precedence over types.
        Parameters:
        nameParts - Expressions that represent a qualified identification of a VariableSymbol, TypeVarSymbol, or TypeSymbol. Therefore, the list that must contain a NameExpression at the beginning, followed only by FieldAccessExpressions.
      • traverse

        public void traverse​(ASTCallExpression expr)
        Deprecated.
        We use traverse to collect the result of the inner part of the expression and calculate the result for the whole expression
        Specified by:
        traverse in interface CommonExpressionsHandler
      • calculateNamingChainCallExpression

        protected void calculateNamingChainCallExpression​(ASTCallExpression expr,
                                                          java.util.List<ExprToNamePair> nameParts,
                                                          java.util.List<SymTypeExpression> argTypes)
        Deprecated.
        Calculate the type result of call expressions that represent fully qualified method calls (like when calling a static method: pac.kage.Type.staticMethod()) and methodCalls on cascading field accesses (e.g., localField.innerField.instanceMethod()). But not: pac.kage.Type.staticMethod().innerField.instanceMethod(), as here instanceMethod is not only qualified by names, but it is based on the access of a value returned by a CallExpression.
        Parameters:
        expr - The call expression itself
        nameParts - The name parts of the method in their order of appearance. Provide both their AST version, and their String version!
        argTypes - the types of the arguments of the method
      • calculateArithmeticCallExpression

        protected void calculateArithmeticCallExpression​(ASTCallExpression expr,
                                                         java.lang.String methodName,
                                                         java.util.List<ExprToOptNamePair> methodCallParts,
                                                         java.util.List<SymTypeExpression> argTypes)
        Deprecated.
        Calculates the type result of the expression, given that it is not a simple, or qualified method access. E.g., this method calculates the result of "FooBar".substring(0, 3), or ( foo ? new LinkedList<String>() : new ArrayList<String>() ).add("bar"). On the other hand, this method is not suited for pac.kage.Owner.staticMethod(), or isInt() (a local Method name). Use calculateNamingChainCallExpression(ASTCallExpression, List, List) in these cases.
      • calculateOwnedCallExpression

        protected void calculateOwnedCallExpression​(ASTCallExpression expr,
                                                    java.lang.String methodName,
                                                    java.util.List<SymTypeExpression> args)
        Deprecated.
        Calculates the type result of the call expression, given that the type result of the method owner has already been computed (and is accessible via getTypeCheckResult()), and that the type of its arguments has already been computed.
      • calculateQualifiedMethod

        protected void calculateQualifiedMethod​(java.lang.String qualName,
                                                ASTCallExpression callExpr,
                                                java.util.List<SymTypeExpression> argTypes)
        Deprecated.
        Checks whether there exists a method symbol with the name given by qualName with matching argument types. If such a method exists, it's return type is set as the type check result.
        Parameters:
        qualName - Qualified name of the method symbol to look for. Can also be a simple name without qualification.
        callExpr - The call expression of the method call. Needed as entry point to the symbol table to resolve method symbols.
        argTypes - The types of the method arguments. Are allowed to be obscure, but in this case the method will also always set *obscure* to be the method's type. Nevertheless, this method may print errors, if there is no method symbol of the given name at all, regardless of matching argument types.
      • calculateFunctionReturnTypeBasedOnSignature

        protected void calculateFunctionReturnTypeBasedOnSignature​(java.util.List<SymTypeOfFunction> candidates,
                                                                   ASTCallExpression callExpr,
                                                                   java.util.List<SymTypeExpression> argTypes,
                                                                   java.util.Map<SymTypeOfFunction,​FunctionSymbol> definingSymbols)
        Deprecated.
        Checks whether any of the candidates functions that the callExpr may represent match the given argTypes signature. If there are multiple candidates remaining and the callExpr has bounds on the types that it may represent, then the candidate with the matching return type is chosen. The chosen candidate's return type is then set as the current type check result.
        Parameters:
        argTypes - The types of the method arguments. Are allowed to be obscure, but in this case the function will also always set *obscure* to be the method's type. Nevertheless, this method may print errors, if there is no method symbol of the given name at all, regardless of matching argument types.
        definingSymbols - if one candidate is found the corresponding symbol is set as the defining symbol, if applicable.
      • calculateMethodReturnTypeBasedOnSignature

        protected void calculateMethodReturnTypeBasedOnSignature​(java.util.List<FunctionSymbol> candidates,
                                                                 ASTCallExpression callExpr,
                                                                 java.util.List<SymTypeExpression> argTypes)
        Deprecated.
        Checks whether any of the candidates methods that the callExpr may represent match the given argTypes signature. If there are multiple candidates remaining and the callExpr has bounds on the types that it may represent, then the candidate with the matching return type is chosen. The chosen candidate's return type is then set as the current type check result.
        Parameters:
        argTypes - The types of the method arguments. Are allowed to be obscure, but in this case the method will also always set *obscure* to be the method's type. Nevertheless, this method may print errors, if there is no method symbol of the given name at all, regardless of matching argument types.
      • getCorrectMethodsFromInnerType

        protected java.util.List<FunctionSymbol> getCorrectMethodsFromInnerType​(SymTypeExpression innerResult,
                                                                                ASTCallExpression expr,
                                                                                java.lang.String name)
        Deprecated.
        Hookpoint for object oriented languages to get the correct functions/methods from a type based on their modifiers
      • filterModifiersFunctions

        protected java.util.List<FunctionSymbol> filterModifiersFunctions​(java.util.List<FunctionSymbol> functionSymbols)
        Deprecated.
        Hookpoint for object oriented languages that offer modifiers like static, public, private, ...
      • calculateTypeCompare

        protected SymTypeExpression calculateTypeCompare​(SymTypeExpression left,
                                                         SymTypeExpression right,
                                                         java.lang.String op,
                                                         de.se_rwth.commons.SourcePosition pos)
        Deprecated.
        helper method for <=, >=, <, > -> calculates the result of these expressions
      • calculateTypeLogical

        protected SymTypeExpression calculateTypeLogical​(SymTypeExpression left,
                                                         SymTypeExpression right,
                                                         java.lang.String op,
                                                         de.se_rwth.commons.SourcePosition pos)
        Deprecated.
        helper method for ==, != calculates the result of these expressions