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, Cloneable
Direct Known Subclasses:
TypeNode.ConstrainedTypeNode, TypeNode.FrameSlotTypeNode, TypeNode.NothingTypeNode, TypeNode.TypeAliasTypeNode, TypeNode.WriteFrameSlotTypeNode

public abstract class TypeNode extends PklNode
  • Constructor Details

    • TypeNode

      protected TypeNode(com.oracle.truffle.api.source.SourceSection sourceSection)
  • Method Details

    • 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 that TypeNode.TypeAliasTypeNode can initialize frame slot of its cloned child node.
    • execute

      public abstract void execute(com.oracle.truffle.api.frame.VirtualFrame frame, 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, Object value)
      Checks if `value` conforms to this type. If so, sets `slot` to `value`. Otherwise, throws a `VmTypeMismatchException`.
    • createDefaultValue

      @Nullable public @Nullable Object createDefaultValue(VmLanguage language, com.oracle.truffle.api.source.SourceSection headerSection, String qualifiedName)
    • forClass

      public static TypeNode forClass(com.oracle.truffle.api.source.SourceSection sourceSection, VmClass clazz)
    • export

      public static PType export(@Nullable @Nullable TypeNode node)
    • getMirror

      public static VmTyped getMirror(@Nullable @Nullable TypeNode node)
    • getMirrors

      public static VmList getMirrors(TypeNode[] nodes)
    • doExport

      protected PType doExport()
    • getVmClass

      @Nullable public @Nullable VmClass getVmClass()
    • getVmTypeAlias

      @Nullable public @Nullable VmTypeAlias getVmTypeAlias()
    • getMirror

      public VmTyped getMirror()
    • getTypeArgumentMirrors

      public VmList getTypeArgumentMirrors()
    • typeMismatch

      protected final VmTypeMismatchException typeMismatch(Object actualValue, Object expectedType)