Package de.monticore.types.check
Class SymTypeSourceInfo
java.lang.Object
de.monticore.types.check.SymTypeSourceInfo
Stores information where a SymTypeExpression comes from.
This additional information can be used in CoCos/code-generation, etc.
There will be no info available if using TypeCheck1.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WeakReference<de.monticore.ast.ASTNode> Usage of a WeakReference over an Optional is mostly symbolic; NEVER rely on this information, but if it is available, it may be of use.protected Optional<de.monticore.symboltable.ISymbol> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid_internal_setSourceNode(de.monticore.ast.ASTNode source) first and foremost called in Type4AstOptional<de.monticore.ast.ASTNode> Source ASTNode of the SymTypeExpression, e.g., if the SymTypeExpression has been calculated as the type of a specific ASTNode, this ASTNode may(!) be returned (no other ASTNode is returned).Optional<de.monticore.symboltable.ISymbol> Source symbol of the SymTypeExpression, e.g., if a variable "int x" is resolved, the type symbol will be int, but the source symbol will be the variable symbol x.voidsetSourceSymbol(de.monticore.symboltable.ISymbol source)
-
Field Details
-
sourceSymbol
-
sourceNode
Usage of a WeakReference over an Optional is mostly symbolic; NEVER rely on this information, but if it is available, it may be of use.
-
-
Constructor Details
-
SymTypeSourceInfo
public SymTypeSourceInfo() -
SymTypeSourceInfo
deep clone
-
-
Method Details
-
getSourceSymbol
Source symbol of the SymTypeExpression, e.g., if a variable "int x" is resolved, the type symbol will be int, but the source symbol will be the variable symbol x.This information can be used for CoCos, code generators, etc.
WARNING: modifying the SymTypeExpression (e.g., normalization) can remove this information. This is deliberate.
This replaces getDefiningSymbol() of TypeCheck1.
-
setSourceSymbol
public void setSourceSymbol(de.monticore.symboltable.ISymbol source) -
getSourceNode
Source ASTNode of the SymTypeExpression, e.g., if the SymTypeExpression has been calculated as the type of a specific ASTNode, this ASTNode may(!) be returned (no other ASTNode is returned).This is ONLY meant to be used to create better log messages! As (especially during type inference) SymTypeExpressions are moved around, cloned, and modified A LOT, therefore, it cannot be assumed that this holds reliable information. The information should still be useful in most cases, though.
-
_internal_setSourceNode
public void _internal_setSourceNode(de.monticore.ast.ASTNode source) first and foremost called in Type4Ast
-