Class FunctionEnvironment

java.lang.Object
com.oracle.truffle.js.parser.env.Environment
com.oracle.truffle.js.parser.env.FunctionEnvironment

public final class FunctionEnvironment extends Environment
  • Field Details

    • DYNAMIC_SCOPE_IDENTIFIER

      public static final com.oracle.truffle.api.strings.TruffleString DYNAMIC_SCOPE_IDENTIFIER
  • Constructor Details

    • FunctionEnvironment

      public FunctionEnvironment(Environment parent, NodeFactory factory, JSContext context, Scope scope, boolean isStrictMode, boolean isEval, boolean isDirectEval, boolean isArrowFunction, boolean isGeneratorFunction, boolean isDerivedConstructor, boolean isAsyncFunction, boolean isGlobal, boolean hasSyntheticArguments)
  • Method Details

    • declareLocalVar

      public JSFrameSlot declareLocalVar(Object name)
      Overrides:
      declareLocalVar in class Environment
    • declareInternalSlot

      public JSFrameSlot declareInternalSlot(Object name)
      Overrides:
      declareInternalSlot in class Environment
    • getReturnSlot

      public JSFrameSlot getReturnSlot()
    • hasReturnSlot

      public boolean hasReturnSlot()
    • getAsyncResultSlot

      public JSFrameSlot getAsyncResultSlot()
    • getAsyncContextSlot

      public JSFrameSlot getAsyncContextSlot()
    • getYieldResultSlot

      public JSFrameSlot getYieldResultSlot()
    • getCurrentBlockScopeSlot

      public JSFrameSlot getCurrentBlockScopeSlot()
      Overrides:
      getCurrentBlockScopeSlot in class Environment
    • isEval

      public boolean isEval()
    • isArrowFunction

      public boolean isArrowFunction()
    • isGeneratorFunction

      public boolean isGeneratorFunction()
    • getBlockFrameDescriptor

      public JSFrameDescriptor getBlockFrameDescriptor()
      Overrides:
      getBlockFrameDescriptor in class Environment
    • findBlockFrameSlot

      public JSFrameSlot findBlockFrameSlot(Object name)
      Overrides:
      findBlockFrameSlot in class Environment
    • findFunctionFrameSlot

      public JSFrameSlot findFunctionFrameSlot(Object name)
      Overrides:
      findFunctionFrameSlot in class Environment
    • pushContinueTarget

    • pushBreakTarget

    • findBreakTarget

      public BreakTarget findBreakTarget(Object label)
    • findContinueTarget

      public ContinueTarget findContinueTarget(Object label)
    • hasReturn

      public boolean hasReturn()
    • addReturn

      public void addReturn()
    • hasAwait

      public boolean hasAwait()
    • addAwait

      public void addAwait()
    • hasYield

      public boolean hasYield()
    • addYield

      public void addYield()
    • setDirectArgumentsAccess

      public void setDirectArgumentsAccess(boolean directArgumentsAccess)
    • isDirectArgumentsAccess

      public boolean isDirectArgumentsAccess()
    • addMappedParameter

      public void addMappedParameter(JSFrameSlot slot, int index)
    • getFunctionName

      public com.oracle.truffle.api.strings.TruffleString getFunctionName()
    • setFunctionName

      public void setFunctionName(com.oracle.truffle.api.strings.TruffleString functionName)
    • getInternalFunctionName

      public com.oracle.truffle.api.strings.TruffleString getInternalFunctionName()
    • setInternalFunctionName

      public void setInternalFunctionName(com.oracle.truffle.api.strings.TruffleString internalFunctionName)
    • getExplicitOrInternalFunctionName

      public com.oracle.truffle.api.strings.TruffleString getExplicitOrInternalFunctionName()
    • setNamedFunctionExpression

      public void setNamedFunctionExpression(boolean isNamedExpression)
    • isNamedFunctionExpression

      protected boolean isNamedFunctionExpression()
    • needsParentFrame

      public boolean needsParentFrame()
    • setNeedsParentFrame

      public void setNeedsParentFrame(boolean needsParentFrame)
    • freeze

      public void freeze()
    • isFrozen

      public boolean isFrozen()
    • isDeepFrozen

      public boolean isDeepFrozen()
    • hasMappedParameters

      public boolean hasMappedParameters()
    • getFunctionFrameDescriptor

      public JSFrameDescriptor getFunctionFrameDescriptor()
      Overrides:
      getFunctionFrameDescriptor in class Environment
    • isStrictMode

      public boolean isStrictMode()
      Overrides:
      isStrictMode in class Environment
    • getParentFunction

      public FunctionEnvironment getParentFunction()
    • getNonArrowParentFunction

      public FunctionEnvironment getNonArrowParentFunction()
    • getScopeLevel

      public int getScopeLevel()
      Overrides:
      getScopeLevel in class Environment
    • isGlobal

      public boolean isGlobal()
    • hasSyntheticArguments

      public boolean hasSyntheticArguments()
    • returnsLastStatementResult

      public boolean returnsLastStatementResult()
    • setIsDynamicallyScoped

      public void setIsDynamicallyScoped(boolean isDynamicallyScoped)
    • isDynamicallyScoped

      public boolean isDynamicallyScoped()
      Function is dynamically scope because it's non-strict and has a direct eval call.
      Overrides:
      isDynamicallyScoped in class Environment
    • isDynamicScopeContext

      public boolean isDynamicScopeContext()
      Description copied from class: Environment
      Environment chain contains a dynamic scope (eval or with) that may shadow variables.
      Overrides:
      isDynamicScopeContext in class Environment
    • getVariableEnvironment

      public Environment getVariableEnvironment()
      Overrides:
      getVariableEnvironment in class Environment
    • isDirectEval

      public boolean isDirectEval()
    • isIndirectEval

      public boolean isIndirectEval()
    • isCallerContextEval

      public boolean isCallerContextEval()
    • inDirectEval

      public boolean inDirectEval()
    • setNeedsNewTarget

      public void setNeedsNewTarget(boolean needsNewTarget)
    • setRestParameter

      public void setRestParameter(boolean restParameter)
    • hasRestParameter

      public boolean hasRestParameter()
    • setSimpleParameterList

      public void setSimpleParameterList(boolean simpleParameterList)
    • hasSimpleParameterList

      public boolean hasSimpleParameterList()
    • getLeadingArgumentCount

      public int getLeadingArgumentCount()
    • isDerivedConstructor

      public boolean isDerivedConstructor()
    • getThisFunctionLevel

      public int getThisFunctionLevel()
      Returns the number of function levels to skip to reach the function with the [[ThisValue]]. Loosely resembles GetThisEnvironment(), but we need to consider eval functions, too.
    • isAsyncFunction

      public boolean isAsyncFunction()
    • isAsyncGeneratorFunction

      public boolean isAsyncGeneratorFunction()
    • getScope

      public Scope getScope()
      Overrides:
      getScope in class Environment
    • isModule

      public boolean isModule()
    • isScriptOrModule

      public boolean isScriptOrModule()
    • prepareForDirectEval

      public void prepareForDirectEval()
    • toStringImpl

      protected String toStringImpl(Map<String,Integer> state)
      Overrides:
      toStringImpl in class Environment