Exemple #1
0
        public override Completion Evaluate(Interpreter interpreter)
        {
            var envBase = interpreter.GetThisEnvironment();

            if (!(envBase is FunctionEnvironmentRecord env))
            {
                throw new InvalidOperationException("Invalid This Environment type for Super");
            }

            var actualThisComp = env.GetThisBinding();

            if (actualThisComp.IsAbrupt())
            {
                return(actualThisComp);
            }
            var actualThis = actualThisComp.value !;

            var propertyNameComp = superIndexerExpression.Evaluate(interpreter).GetValue();

            if (propertyNameComp.IsAbrupt())
            {
                return(propertyNameComp);
            }
            var propertyNameValue = propertyNameComp.value !;

            var propertyKey = propertyNameValue.ToPropertyKey();

            if (propertyKey.IsAbrupt())
            {
                return(propertyKey);
            }
            return(SuperHelper.MakeSuperPropertyReference(actualThis, propertyKey.Other !, IsStrictMode));
        }
Exemple #2
0
        public override Completion Evaluate(Interpreter interpreter)
        {
            var envBase = interpreter.GetThisEnvironment();

            if (!(envBase is FunctionEnvironmentRecord env))
            {
                throw new InvalidOperationException("Invalid This Environment type for Super");
            }

            var actualThisComp = env.GetThisBinding();

            if (actualThisComp.IsAbrupt())
            {
                return(actualThisComp);
            }
            var actualThis = actualThisComp.value !;

            return(SuperHelper.MakeSuperPropertyReference(actualThis, superDotIdentifierName, IsStrictMode));
        }