/// <summary>
 ///     Assign to the result from expressionTarget via the proprertySetMethodId the result from assignmentExpression
 /// </summary>
 public AssignReferenceProperty(Expression expressionTarget, Int32 propertySetMethodId,
                                Expression assignmentExpression)
 {
     m_ExpressionTarget = expressionTarget;
     m_PropertySetMethodId = propertySetMethodId;
     m_AssignmentExpression = assignmentExpression;
 }
        public AssignReference(Int32 index, Expression expression)
        {
            m_Index = index;
            m_Expression = expression;

            if (m_Expression.ReturnType != GossipType.ReferenceObject)
                throw new GossipScriptException("Expected Return type is reference object");
        }
Example #3
0
        public AssignString(Int32 destIndex, VariableScope destScope, Expression expression)
        {
            m_DestIndex = destIndex;
            m_DestScope = destScope;
            m_Expression = expression;

            if (expression.ReturnType != GossipType.String)
                throw new GossipScriptException("Expression must return type string");
        }
        public void AssertEquality(Expression exp1, Expression exp2, Nullable<double> expectedResult = null)
        {
            Trace.WriteLine("");
            Assert.IsTrue(exp1.ReturnType == exp2.ReturnType);

            for (int i = 0; i < exp1.Instructions.Count; i++)
            {
                Trace.WriteLine(exp1.Instructions[i].TokenType);
            }

            Trace.WriteLine("");

            for (int i = 0; i < exp2.Instructions.Count; i++)
            {
                Trace.WriteLine(exp2.Instructions[i].TokenType);
            }
            Assert.IsTrue(exp1.Instructions.Count == exp2.Instructions.Count);

            for (int i = 0; i < exp2.Instructions.Count; i++)
            {
                Trace.WriteLine(String.Format("Comp: {0} to {1}",exp1.Instructions[i].TokenType,exp2.Instructions[i].TokenType));

                Assert.IsTrue(exp1.Instructions[i].TokenType == exp2.Instructions[i].TokenType);
                //Assert.IsTrue(exp1.Instructions[i].TokenValue == exp2.Instructions[i].TokenValue);
            }

            var context = new ScriptExecutionContext(null ,new LocalState());
            context.Vm = m_Vm;

            Trace.WriteLine("Eval A");
            var r1 = m_Vm.HostBridge.ExpressionEvaluator.EvaluateDouble(exp1, context);

            Trace.WriteLine("Eval B");
            var r2 = m_Vm.HostBridge.ExpressionEvaluator.EvaluateDouble(exp1, context);

            Assert.IsTrue(r1 == r2);

            if (expectedResult != null)
                Assert.IsTrue(r1 == expectedResult.Value);
        }
 public EvalModuleAction(Expression expression)
 {
     m_Expression = expression;
 }
 /// <summary>
 ///     Assign to the object reference in index 'refIndex' using the result from assignmentExpression via propertySetMethodId
 ///     Note: If refIndex is -1 then the result is applied to the self object.
 /// </summary>
 public AssignReferenceProperty(Int32 refIndex, Int32 propertySetMethodId, Expression assignmentExpression)
 {
     m_RefIndex = refIndex;
     m_PropertySetMethodId = propertySetMethodId;
     m_AssignmentExpression = assignmentExpression;
 }
 public CustomActionContext(List<Expression> parameters, Expression targetExpression)
 {
     m_Expressions = parameters;
     m_TargetExpression = targetExpression;
     m_Parameters = new object[parameters.Count];
 }
Example #8
0
 public EvalAction(Expression expression)
 {
     m_Expression = expression;
 }