Class Type4Ast
getTypeOfExpression(de.monticore.expressions.expressionsbasis._ast.ASTExpression).
get the type of a type identifier (e.g., "int") using
getTypeOfTypeIdentifier(de.monticore.types.mcbasictypes._ast.ASTMCType).
The getters marked with "Partial" and the setters
are used by the type traverser filling the map.
Setting a null value will remove the entry.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<de.monticore.ast.ASTNode, SymTypeExpression> the actual map from expression to types, strictly seperated from the map for type identifiers we use ASTNode to support non-ASTExpression Nodes (e.g., literals) however, we do NOT support non-expression ASTNodes, e.g.protected static final Stringprotected Map<de.monticore.ast.ASTNode, SymTypeExpression> the actual map from type identifier to types, strictly seperated from the map for expressions we use ASTNode to support non-ASTMCType Nodes (e.g. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertNoInferenceVars(de.monticore.ast.ASTNode node, SymTypeExpression type) If there are any inference variables to be (indirectly) stored in Type4Ast, either an internal programming error occurred, or no Type inference traverser has run and replaced it with an instantiation.protected Map<de.monticore.ast.ASTNode, SymTypeExpression> getPartialTypeOfExpr(ASTExpression astExpr) getPartialTypeOfExpr(ASTLiteral astLit) getPartialTypeOfTypeId(ASTMCReturnType mcReturnType) getPartialTypeOfTypeId(ASTMCType mcType) getPartialTypeOfTypeId(ASTMCTypeArgument typeArg) getPartialTypeOfTypeIdForName(ASTExpression nameExpr) A special case for specific MCQualifiedNames s.protected Map<de.monticore.ast.ASTNode, SymTypeExpression> getTypeOfExpression(ASTExpression astExpr) gets the type information of the expressiongetTypeOfExpression(ASTLiteral astLit) gets the type information of the literalgetTypeOfTypeIdentifier(ASTMCReturnType mcReturnType) getTypeOfTypeIdentifier(ASTMCType mcType) getTypeOfTypeIdentifier(ASTMCTypeArgument typeArg) booleanhasPartialTypeOfExpression(ASTExpression astExpr) booleanhasPartialTypeOfExpression(ASTLiteral astLit) booleanbooleanhasPartialTypeOfTypeIdentifier(ASTMCReturnType mcReturnType) booleanbooleanhasPartialTypeOfTypeIdentifier(ASTMCTypeArgument mcTypeArg) booleanbooleanhasTypeOfExpression(ASTExpression astExpr) whether a type has been calculated for the expressionbooleanhasTypeOfExpression(ASTLiteral astLit) whether a type has been calculated for the literalbooleanbooleanhasTypeOfTypeIdentifier(ASTMCReturnType mcReturnType) booleanhasTypeOfTypeIdentifier(ASTMCType mcType) booleanhasTypeOfTypeIdentifier(ASTMCTypeArgument mcTypeArg) booleanhasTypeOfTypeIdentifierForName(ASTExpression nameExpr) protected SymTypeExpressioninternal_getPartialTypeOfExpr(de.monticore.ast.ASTNode node) returns potentially partial type information of the expression internally used by type deriverprotected SymTypeExpressioninternal_getPartialTypeOfTypeId(de.monticore.ast.ASTNode node) returns potentially partial type information of the type identifier used by type deriverinternal_getPartialTypeOfTypeId2(de.monticore.ast.ASTNode node) Deprecated.do not use, only here until fix in grammarprotected SymTypeExpressioninternal_getTypeOfExpression(de.monticore.ast.ASTNode node) protected SymTypeExpressioninternal_getTypeOfTypeIdentifier(de.monticore.ast.ASTNode node) gets the type of the type identifier if it has been calculatedprotected booleaninternal_hasPartialTypeOfExpression(de.monticore.ast.ASTNode node) protected booleaninternal_hasPartialTypeOfTypeIdentifier(de.monticore.ast.ASTNode node) whether a type has been calculated for the type identifierprotected booleaninternal_hasTypeOfExpression(de.monticore.ast.ASTNode node) protected booleaninternal_hasTypeOfTypeIdentifier(de.monticore.ast.ASTNode node) whether a type has been calculated for the type identifierprotected voidinternal_setTypeOfExpression(de.monticore.ast.ASTNode node, SymTypeExpression typeExpr) protected voidinternal_setTypeOfTypeIdentifier(de.monticore.ast.ASTNode node, SymTypeExpression typeExpr) sets the type information of the type identifier, information may be partialvoidinternal_setTypeOfTypeIdentifier2(de.monticore.ast.ASTNode node, SymTypeExpression type) Deprecated.do not use, remove after fix of grammarsprotected booleanisQNameExpr(ASTExpression expr) whether the expression represents a qualified nameprotected Stringnode2InfoString(de.monticore.ast.ASTNode node) helps with logging.voidreset()voidreset(de.monticore.ast.ASTNode rootNode) This removes the stored values of every node below and including the provided root.voidsetTypeOfExpression(ASTExpression astExpr, SymTypeExpression typeExpr) sets the type information of the expression, information may be partialvoidsetTypeOfExpression(ASTLiteral astLit, SymTypeExpression typeExpr) sets the type information of the literal, information may be partialvoidsetTypeOfTypeIdentifier(ASTMCQualifiedName qName, SymTypeExpression type) voidsetTypeOfTypeIdentifier(ASTMCReturnType mcReturnType, SymTypeExpression type) voidsetTypeOfTypeIdentifier(ASTMCType mcType, SymTypeExpression type) voidsetTypeOfTypeIdentifier(ASTMCTypeArgument typeArg, SymTypeExpression type) voida special case of the MCQualifiedName s.voida special case of the MCQualifiedName
-
Field Details
-
LOG_NAME
- See Also:
-
expr2type
the actual map from expression to types, strictly seperated from the map for type identifiers we use ASTNode to support non-ASTExpression Nodes (e.g., literals) however, we do NOT support non-expression ASTNodes, e.g. in MyClass.myMethod(): the "MyClass" is not an expression by itself -
typeID2type
the actual map from type identifier to types, strictly seperated from the map for expressions we use ASTNode to support non-ASTMCType Nodes (e.g. qualified Names) however, we do NOT support expression ASTNodes, e.g. other qualified names that represent a variable, rather than a type
-
-
Constructor Details
-
Type4Ast
public Type4Ast()
-
-
Method Details
-
getExpression2Type
-
getTypeIdentifier2Type
-
reset
public void reset() -
reset
public void reset(de.monticore.ast.ASTNode rootNode) This removes the stored values of every node below and including the provided root. This can be required to, e.g., rerun the type checker multiple times during type inference. -
hasTypeOfExpression
whether a type has been calculated for the expression -
hasTypeOfExpression
whether a type has been calculated for the literal -
internal_hasTypeOfExpression
protected boolean internal_hasTypeOfExpression(de.monticore.ast.ASTNode node) -
hasPartialTypeOfExpression
-
hasPartialTypeOfExpression
-
internal_hasPartialTypeOfExpression
protected boolean internal_hasPartialTypeOfExpression(de.monticore.ast.ASTNode node) -
hasTypeOfTypeIdentifier
-
hasTypeOfTypeIdentifier
-
hasTypeOfTypeIdentifier
-
hasTypeOfTypeIdentifier
-
hasTypeOfTypeIdentifierForName
-
internal_hasTypeOfTypeIdentifier
protected boolean internal_hasTypeOfTypeIdentifier(de.monticore.ast.ASTNode node) whether a type has been calculated for the type identifier -
hasPartialTypeOfTypeIdentifier
-
hasPartialTypeOfTypeIdentifier
-
hasPartialTypeOfTypeIdentifier
-
hasPartialTypeOfTypeIdentifier
-
hasPartialTypeOfTypeIdentifierForName
-
internal_hasPartialTypeOfTypeIdentifier
protected boolean internal_hasPartialTypeOfTypeIdentifier(de.monticore.ast.ASTNode node) whether a type has been calculated for the type identifier -
getTypeOfExpression
gets the type information of the expression -
getTypeOfExpression
gets the type information of the literal -
internal_getTypeOfExpression
-
getPartialTypeOfExpr
-
getPartialTypeOfExpr
-
internal_getPartialTypeOfExpr
returns potentially partial type information of the expression internally used by type deriver -
getTypeOfTypeIdentifier
-
getTypeOfTypeIdentifier
-
getTypeOfTypeIdentifier
-
getTypeOfTypeIdentifier
-
internal_getTypeOfTypeIdentifier
gets the type of the type identifier if it has been calculated -
getPartialTypeOfTypeId
-
getPartialTypeOfTypeId
-
getPartialTypeOfTypeId
-
getPartialTypeOfTypeId
-
getPartialTypeOfTypeIdForName
A special case for specific MCQualifiedNames s.setTypeOfTypeIdentifierForName(ASTFieldAccessExpression, SymTypeExpression) -
internal_getPartialTypeOfTypeId2
@Deprecated public SymTypeExpression internal_getPartialTypeOfTypeId2(de.monticore.ast.ASTNode node) Deprecated.do not use, only here until fix in grammar -
internal_getPartialTypeOfTypeId
returns potentially partial type information of the type identifier used by type deriver -
setTypeOfExpression
sets the type information of the expression, information may be partial -
setTypeOfExpression
sets the type information of the literal, information may be partial -
internal_setTypeOfExpression
protected void internal_setTypeOfExpression(de.monticore.ast.ASTNode node, SymTypeExpression typeExpr) -
setTypeOfTypeIdentifier
-
setTypeOfTypeIdentifier
-
setTypeOfTypeIdentifier
-
setTypeOfTypeIdentifierForName
a special case of the MCQualifiedName s.setTypeOfTypeIdentifierForName(ASTNameExpression, SymTypeExpression) -
setTypeOfTypeIdentifierForName
a special case of the MCQualifiedNamethis is only used in cases there the type identifier 1. was parsed as an expression (instead of a MCQualifiedName) and 2. the AST can not be transformed to accommodate without non-conservative grammar changes
In our Java-esque languages, this usually happens before ".", e.g., C in C.staticVar, C.staticMethod() C.this.var, C.super.method(), ... As the type id has been parsed as an expression, and nothing further is known without reflection, getting the type information cannot be type safe ("type safe" as in (partially) ensuring correct usage by the type checker), thus the uniqueness of the methods' names. note that (technically) not even ASTExpression applicable enough, due to some grammar extension points The getter is
getPartialTypeOfTypeIdForName(ASTExpression) -
setTypeOfTypeIdentifier
-
internal_setTypeOfTypeIdentifier2
@Deprecated public void internal_setTypeOfTypeIdentifier2(de.monticore.ast.ASTNode node, SymTypeExpression type) Deprecated.do not use, remove after fix of grammars -
internal_setTypeOfTypeIdentifier
protected void internal_setTypeOfTypeIdentifier(de.monticore.ast.ASTNode node, SymTypeExpression typeExpr) sets the type information of the type identifier, information may be partial -
assertNoInferenceVars
If there are any inference variables to be (indirectly) stored in Type4Ast, either an internal programming error occurred, or no Type inference traverser has run and replaced it with an instantiation. -
isQNameExpr
whether the expression represents a qualified name -
node2InfoString
helps with logging.
-