public override Completion Evaluate(Interpreter interpreter)
 {
     if (!(leftHandSideExpression is ObjectLiteral) && !(leftHandSideExpression is ArrayLiteral))
     {
         var lrefComp = leftHandSideExpression.Evaluate(interpreter);
         if (lrefComp.IsAbrupt())
         {
             return(lrefComp);
         }
         var lref = lrefComp.value;
         if (!(lref is ReferenceValue referenceValue))
         {
             throw new InvalidOperationException("AssignmentExpression.Evaluate: left hand side did not return a reference.");
         }
         Completion rval;
         if (assignmentExpression is FunctionExpression functionExpression && functionExpression.isAnonymous && leftHandSideExpression is IdentifierReference)
         {
             rval = functionExpression.NamedEvaluate(interpreter, referenceValue.referencedName);
         }
         else
         {
             rval = assignmentExpression.Evaluate(interpreter).GetValue();
         }
         if (rval.IsAbrupt())
         {
             return(rval);
         }
         var comp = referenceValue.PutValue(rval.value !);
         if (comp.IsAbrupt())
         {
             return(comp);
         }
         return(rval);
     }
        public override Completion Evaluate(Interpreter interpreter)
        {
            var conditionComp = logicalOrExpression.Evaluate(interpreter).GetValue();

            if (conditionComp.IsAbrupt())
            {
                return(conditionComp);
            }
            var condition = conditionComp.value !.ToBoolean();

            if (condition.boolean)
            {
                return(ifTrueAssignmentExpression.Evaluate(interpreter).GetValue());
            }
            else
            {
                return(ifFalseAssignmentExpression.Evaluate(interpreter).GetValue());
            }
        }
        public Completion PropertyDefinitionEvaluation(Object @object, bool enumerable)
        {
            var valueComp = assignmentExpression.Evaluate(Interpreter.Instance());

            if (valueComp.IsAbrupt())
            {
                return(valueComp);
            }
            var value = valueComp.value;

            if (!(value is Object source))
            {
                throw new InvalidOperationException($"ObjectLiteral: tried to initialize an object using a spread on a non-object");
            }
            valueComp = Utils.CopyDataProperties(@object, source, excludedItems: Utils.EmptyList <string>());
            if (valueComp.IsAbrupt())
            {
                return(valueComp);
            }
            return(Completion.NormalCompletion());
        }