Package org.pkl.core.ast.type
Class TypeNode
- java.lang.Object
-
- com.oracle.truffle.api.nodes.Node
-
- org.pkl.core.ast.PklNode
-
- org.pkl.core.ast.type.TypeNode
-
- All Implemented Interfaces:
com.oracle.truffle.api.nodes.NodeInterface,java.lang.Cloneable
- Direct Known Subclasses:
TypeNode.ConstrainedTypeNode,TypeNode.FrameSlotTypeNode,TypeNode.NothingTypeNode,TypeNode.TypeAliasTypeNode,TypeNode.WriteFrameSlotTypeNode
public abstract class TypeNode extends PklNode
-
-
Nested Class Summary
-
Field Summary
-
Fields inherited from class org.pkl.core.ast.PklNode
sourceSection
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTypeNode(com.oracle.truffle.api.source.SourceSection sourceSection)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @Nullable java.lang.ObjectcreateDefaultValue(VmLanguage language, com.oracle.truffle.api.source.SourceSection headerSection, java.lang.String qualifiedName)protected PTypedoExport()abstract voidexecute(com.oracle.truffle.api.frame.VirtualFrame frame, java.lang.Object value)Checks if `value` conforms to this type.abstract voidexecuteAndSet(com.oracle.truffle.api.frame.VirtualFrame frame, java.lang.Object value)Checks if `value` conforms to this type.static PTypeexport(@Nullable TypeNode node)static TypeNodeforClass(com.oracle.truffle.api.source.SourceSection sourceSection, VmClass clazz)abstract com.oracle.truffle.api.frame.FrameSlotKindgetFrameSlotKind()VmTypedgetMirror()static VmTypedgetMirror(@Nullable TypeNode node)static VmListgetMirrors(TypeNode[] nodes)VmListgetTypeArgumentMirrors()@Nullable VmClassgetVmClass()@Nullable VmTypeAliasgetVmTypeAlias()abstract TypeNodeinitWriteSlotNode(int slot)Initializes this node's frame slot.booleanisNoopTypeCheck()protected VmTypeMismatchExceptiontypeMismatch(java.lang.Object actualValue, java.lang.Object expectedType)-
Methods inherited from class org.pkl.core.ast.PklNode
exceptionBuilder, getShortName, getSourceSection, toString
-
Methods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize
-
-
-
-
Method Detail
-
isNoopTypeCheck
public boolean isNoopTypeCheck()
-
getFrameSlotKind
public abstract com.oracle.truffle.api.frame.FrameSlotKind getFrameSlotKind()
-
initWriteSlotNode
public abstract TypeNode initWriteSlotNode(int slot)
Initializes this node's frame slot. Called if this node is a function/method parameter type. Kept separate from constructor so thatTypeNode.TypeAliasTypeNodecan initialize frame slot of its cloned child node.
-
execute
public abstract void execute(com.oracle.truffle.api.frame.VirtualFrame frame, java.lang.Object value)Checks if `value` conforms to this type. If so, returns normally. Otherwise, throws a `VmTypeMismatchException`.
-
executeAndSet
public abstract void executeAndSet(com.oracle.truffle.api.frame.VirtualFrame frame, java.lang.Object value)Checks if `value` conforms to this type. If so, sets `slot` to `value`. Otherwise, throws a `VmTypeMismatchException`.
-
createDefaultValue
public @Nullable java.lang.Object createDefaultValue(VmLanguage language, com.oracle.truffle.api.source.SourceSection headerSection, java.lang.String qualifiedName)
-
forClass
public static TypeNode forClass(com.oracle.truffle.api.source.SourceSection sourceSection, VmClass clazz)
-
doExport
protected PType doExport()
-
getVmTypeAlias
public @Nullable VmTypeAlias getVmTypeAlias()
-
getMirror
public VmTyped getMirror()
-
getTypeArgumentMirrors
public VmList getTypeArgumentMirrors()
-
typeMismatch
protected final VmTypeMismatchException typeMismatch(java.lang.Object actualValue, java.lang.Object expectedType)
-
-