Class JSToObjectArrayNode

java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.js.nodes.JavaScriptBaseNode
com.oracle.truffle.js.nodes.cast.JSToObjectArrayNode
All Implemented Interfaces:
com.oracle.truffle.api.nodes.NodeInterface, Cloneable

public abstract class JSToObjectArrayNode extends JavaScriptBaseNode
Converts an arbitrary array-like object to an Object[], with an optional array length limit.

By default, throws TypeError for null and undefined (can be changed by using create(boolean)). Throws a RangeError if the array length exceeds the optional array length limit or the maximum Java array size.

See Also:
  • Field Details

    • nullOrUndefinedAsEmptyArray

      protected final boolean nullOrUndefinedAsEmptyArray
  • Constructor Details

    • JSToObjectArrayNode

      protected JSToObjectArrayNode(boolean nullOrUndefinedAsEmptyArray)
  • Method Details

    • executeObjectArray

      public final Object[] executeObjectArray(Object value)
    • executeObjectArray

      public abstract Object[] executeObjectArray(Object value, int arrayLengthLimit)
    • create

      public static JSToObjectArrayNode create()
    • create

      public static JSToObjectArrayNode create(boolean nullOrUndefinedAsEmptyArray)
    • create

      public static JavaScriptNode create(JSContext context, JavaScriptNode operand)
    • toArray

      protected Object[] toArray(JSObject obj, int arrayLengthLimit, com.oracle.truffle.api.nodes.Node node, JSGetLengthNode getLengthNode, ReadElementNode readNode, com.oracle.truffle.api.profiles.InlinedBranchProfile errorBranch)
    • doUndefined

      protected Object[] doUndefined(Object value, int arrayLengthLimit)
    • doNull

      protected Object[] doNull(Object value, int arrayLengthLimit)
    • passArray

      protected Object[] passArray(Object[] array, int arrayLengthLimit, com.oracle.truffle.api.profiles.InlinedBranchProfile errorBranch)
    • doForeignObject

      protected Object[] doForeignObject(Object obj, int arrayLengthLimit, com.oracle.truffle.api.nodes.Node node, com.oracle.truffle.api.interop.InteropLibrary interop, com.oracle.truffle.api.profiles.InlinedBranchProfile errorBranch, ImportValueNode foreignConvertNode)
    • doFallback

      protected Object[] doFallback(Object value, int arrayLengthLimit)