Class FunctionEnvironment
java.lang.Object
com.oracle.truffle.js.parser.env.Environment
com.oracle.truffle.js.parser.env.FunctionEnvironment
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassNested classes/interfaces inherited from class com.oracle.truffle.js.parser.env.Environment
Environment.AbstractFrameVarRef, Environment.FrameSlotVarRef, Environment.GlobalLexVarRef, Environment.GlobalVarRef, Environment.MappedArgumentVarRef, Environment.VarRef, Environment.WrappedVarRef -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.oracle.truffle.api.strings.TruffleStringFields inherited from class com.oracle.truffle.js.parser.env.Environment
context, factory -
Constructor Summary
ConstructorsConstructorDescriptionFunctionEnvironment(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 Summary
Modifier and TypeMethodDescriptionvoidaddAwait()voidaddMappedParameter(JSFrameSlot slot, int index) voidvoidaddYield()declareInternalSlot(Object name) declareLocalVar(Object name) findBlockFrameSlot(Object name) findBreakTarget(Object label) findContinueTarget(Object label) findFunctionFrameSlot(Object name) voidfreeze()com.oracle.truffle.api.strings.TruffleStringcom.oracle.truffle.api.strings.TruffleStringcom.oracle.truffle.api.strings.TruffleStringintgetScope()intintReturns the number of function levels to skip to reach the function with the [[ThisValue]].booleanhasAwait()booleanbooleanbooleanbooleanbooleanbooleanbooleanhasYield()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanFunction is dynamically scope because it's non-strict and has a direct eval call.booleanEnvironment chain contains a dynamic scope (eval or with) that may shadow variables.booleanisEval()booleanisFrozen()booleanbooleanisGlobal()booleanbooleanisModule()protected booleanbooleanbooleanbooleanvoidpushBreakTarget(String label) pushContinueTarget(String label) booleanvoidsetDirectArgumentsAccess(boolean directArgumentsAccess) voidsetFunctionName(com.oracle.truffle.api.strings.TruffleString functionName) voidsetInternalFunctionName(com.oracle.truffle.api.strings.TruffleString internalFunctionName) voidsetIsDynamicallyScoped(boolean isDynamicallyScoped) voidsetNamedFunctionExpression(boolean isNamedExpression) voidsetNeedsNewTarget(boolean needsNewTarget) voidsetNeedsParentFrame(boolean needsParentFrame) voidsetRestParameter(boolean restParameter) voidsetSimpleParameterList(boolean simpleParameterList) protected StringtoStringImpl(Map<String, Integer> state) Methods inherited from class com.oracle.truffle.js.parser.env.Environment
addFrameSlotFromSymbol, addFrameSlotsFromSymbols, addFrameSlotsFromSymbols, createLocal, createTempVar, findActiveModule, findArgumentsVar, findAsyncContextVar, findAsyncResultVar, findBlockScopedVar, findDynamicScopeVar, findInternalSlot, findInternalSlot, findInternalSlot, findLocalVar, findNewTargetVar, findSuperVar, findTempVar, findThisVar, findVar, findVar, findVar, findYieldValueVar, function, getBlockScopeSlot, getParent, getParentAt, hasLocalVar, hasScopeFrame, joinElements, reserveArgumentsSlot, reserveDynamicScopeSlot, reserveNewTargetSlot, reserveSuperSlot, reserveThisSlot, toString
-
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
- Overrides:
declareLocalVarin classEnvironment
-
declareInternalSlot
- Overrides:
declareInternalSlotin classEnvironment
-
getReturnSlot
-
hasReturnSlot
public boolean hasReturnSlot() -
getAsyncResultSlot
-
getAsyncContextSlot
-
getYieldResultSlot
-
getCurrentBlockScopeSlot
- Overrides:
getCurrentBlockScopeSlotin classEnvironment
-
isEval
public boolean isEval() -
isArrowFunction
public boolean isArrowFunction() -
isGeneratorFunction
public boolean isGeneratorFunction() -
getBlockFrameDescriptor
- Overrides:
getBlockFrameDescriptorin classEnvironment
-
findBlockFrameSlot
- Overrides:
findBlockFrameSlotin classEnvironment
-
findFunctionFrameSlot
- Overrides:
findFunctionFrameSlotin classEnvironment
-
pushContinueTarget
-
pushBreakTarget
-
findBreakTarget
-
findContinueTarget
-
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
-
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
- Overrides:
getFunctionFrameDescriptorin classEnvironment
-
isStrictMode
public boolean isStrictMode()- Overrides:
isStrictModein classEnvironment
-
getParentFunction
-
getNonArrowParentFunction
-
getScopeLevel
public int getScopeLevel()- Overrides:
getScopeLevelin classEnvironment
-
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:
isDynamicallyScopedin classEnvironment
-
isDynamicScopeContext
public boolean isDynamicScopeContext()Description copied from class:EnvironmentEnvironment chain contains a dynamic scope (eval or with) that may shadow variables.- Overrides:
isDynamicScopeContextin classEnvironment
-
getVariableEnvironment
- Overrides:
getVariableEnvironmentin classEnvironment
-
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
- Overrides:
getScopein classEnvironment
-
isModule
public boolean isModule() -
isScriptOrModule
public boolean isScriptOrModule() -
prepareForDirectEval
public void prepareForDirectEval() -
toStringImpl
- Overrides:
toStringImplin classEnvironment
-