Class VmFunction


public final class VmFunction extends VmObjectLike
  • Constructor Details

  • Method Details

    • getCallTarget

      public com.oracle.truffle.api.RootCallTarget getCallTarget()
    • getParameterCount

      public int getParameterCount()
    • apply

      public Object apply(Object arg1)
    • apply

      public Object apply(Object arg1, Object arg2)
    • copy

      public VmFunction copy(int newParamCount, @Nullable @Nullable PklRootNode newRootNode, @Nullable @Nullable Object newExtraStorage)
    • getThisValue

      public Object getThisValue()
    • getParent

      public VmObjectLike getParent()
      Description copied from class: VmObjectLike
      Returns the parent object in the prototype chain. For each concrete subclass X of VmObjectLike, the exact return type of this method is `X|VmTyped`.
      Specified by:
      getParent in class VmObjectLike
    • hasMember

      public boolean hasMember(Object key)
      Description copied from class: VmObjectLike
      Always prefer this method over `getMembers().containsKey(key)`.
      Specified by:
      hasMember in class VmObjectLike
    • getMember

      @Nullable public @Nullable ObjectMember getMember(Object key)
      Description copied from class: VmObjectLike
      Always prefer this method over `getMembers().get(key)`.
      Specified by:
      getMember in class VmObjectLike
    • getMembers

      public org.graalvm.collections.UnmodifiableEconomicMap<Object,ObjectMember> getMembers()
      Description copied from class: VmObjectLike
      Returns the declared members of this object.
      Specified by:
      getMembers in class VmObjectLike
    • getCachedValue

      @Nullable public @Nullable Object getCachedValue(Object key)
      Description copied from class: VmObjectLike
      Reads from the properties cache for this object. The cache contains the values of all members defined in this object or an ancestor thereof which have been requested with this object as the receiver.
      Specified by:
      getCachedValue in class VmObjectLike
    • setCachedValue

      public void setCachedValue(Object key, Object value)
      Description copied from class: VmObjectLike
      Writes to the properties cache for this object. The cache contains the values of all members defined in this object or an ancestor thereof which have been requested with this object as the receiver.
      Specified by:
      setCachedValue in class VmObjectLike
    • hasCachedValue

      public boolean hasCachedValue(Object key)
      Description copied from class: VmObjectLike
      Prefer this method over VmObjectLike.getCachedValue(java.lang.Object) if the value is not required. (There is no point in calling this method to determine whether to call VmObjectLike.getCachedValue(java.lang.Object).)
      Specified by:
      hasCachedValue in class VmObjectLike
    • iterateMemberValues

      public boolean iterateMemberValues(VmObjectLike.MemberValueConsumer consumer)
      Description copied from class: VmObjectLike
      Iterates over member definitions and their values in order of their definition, from the top of the prototype chain downwards. If a member value has not yet been evaluated, a `null` `value` is passed to `consumer`. If a member is defined in multiple objects in the prototype chain, i.e., is overridden along the way, it is visited only once, with the initial (i.e., upmost) `member` and the final (i.e., downmost) `value`. (This peculiar behavior serves two purposes in the current implementation: it guarantees that a `hidden` property is still recognized as such when overridden, and that an element is still recognized as such when overridden with entry syntax. It also means that members are visited in order of (first) definition.) Local, hidden, and external properties are not visited. If an invocation of `consumer` returns `false`, the remaining members are not visited, and `false` is returned. Otherwise, all members are visited, and `true` is returned.
      Specified by:
      iterateMemberValues in class VmObjectLike
    • forceAndIterateMemberValues

      public boolean forceAndIterateMemberValues(VmObjectLike.ForcedMemberValueConsumer consumer)
      Description copied from class: VmObjectLike
      Same as VmObjectLike.iterateMemberValues(org.pkl.core.runtime.VmObjectLike.MemberValueConsumer) except that it first performs a shallow VmObjectLike.force(boolean, boolean). As a consequence, values passed to consumer are guaranteed to be non-null.
      Specified by:
      forceAndIterateMemberValues in class VmObjectLike
    • iterateAlreadyForcedMemberValues

      public boolean iterateAlreadyForcedMemberValues(VmObjectLike.ForcedMemberValueConsumer consumer)
      Specified by:
      iterateAlreadyForcedMemberValues in class VmObjectLike
    • iterateMembers

      public boolean iterateMembers(BiFunction<Object,ObjectMember,Boolean> consumer)
      Description copied from class: VmObjectLike
      Iterates over member definitions in order of their definition, from the top of the prototype chain downwards. If a member is defined multiple times, each occurrence is visited. Local properties are not visited. If an invocation of `consumer` returns `false`, the remaining members are not visited, and `false` is returned. Otherwise, all members are visited, and `true` is returned.
      Specified by:
      iterateMembers in class VmObjectLike
    • getVmClass

      public VmClass getVmClass()
      Specified by:
      getVmClass in class VmValue
    • force

      public void force(boolean allowUndefinedValues, boolean recurse)
      Description copied from class: VmObjectLike
      Forces shallow or recursive (deep) evaluation of this object.
      Specified by:
      force in class VmObjectLike
    • force

      public void force(boolean allowUndefinedValues)
      Description copied from class: VmValue
      Forces recursive (deep) evaluation of this value.
      Specified by:
      force in class VmValue
    • export

      public Object export()
      Description copied from class: VmObjectLike
      Exports this object to an external representation. Does not export local, hidden, or external properties
      Specified by:
      export in class VmObjectLike
    • accept

      public void accept(VmValueVisitor visitor)
      Specified by:
      accept in class VmValue
    • accept

      public <T> T accept(VmValueConverter<T> converter, Iterable<Object> path)
      Specified by:
      accept in class VmValue
    • equals

      public boolean equals(Object obj)
      Description copied from class: VmValue
      Enables calling `vmValue.equals()` when not behind a Truffle boundary.
      Specified by:
      equals in class VmValue
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object