示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void popVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext) throws org.boris.expr.ExprException
        private void popVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext)
        {
            foreach (FunctionArgumentTable functionArgumentTable in this.inputArguments)
            {
                paramExprAbstractEvaluationContext.removeAdditionalVariable(functionArgumentTable.Name.ToUpper());
            }
            foreach (FunctionArgumentTable functionArgumentTable in this.constArguments)
            {
                paramExprAbstractEvaluationContext.removeAdditionalVariable(functionArgumentTable.Name.ToUpper());
            }
            foreach (string str in this.previousArgs.Keys)
            {
                paramExprAbstractEvaluationContext.addAdditionalVariable(str, (Expr)this.previousArgs[str]);
            }
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void pushVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual void pushVariables(ExprAbstractEvaluationContext paramExprAbstractEvaluationContext, Expr[] paramArrayOfExpr)
        {
            bool @bool = false;

            if (this.jsLanguage && this.engine == null)
            {
                @bool = true;
            }
            this.previousArgs.Clear();
            sbyte b = 0;

            foreach (FunctionArgumentTable functionArgumentTable in this.inputArguments)
            {
                if (paramExprAbstractEvaluationContext.hasAdditionalVariable(this.fTable.Name.ToUpper()))
                {
                    this.previousArgs[functionArgumentTable.Name] = paramExprAbstractEvaluationContext.getAdditionalVariableValue(functionArgumentTable.Name);
                }
                paramExprAbstractEvaluationContext.addAdditionalVariable(functionArgumentTable.Name.ToUpper(), paramArrayOfExpr[b]);
                if (this.jsLanguage)
                {
                    if (paramArrayOfExpr[b] is ExprDouble)
                    {
                        Engine.put(functionArgumentTable.Name, Convert.ToDouble(((ExprDouble)paramArrayOfExpr[b]).doubleValue()));
                    }
                    else if (paramArrayOfExpr[b] is ExprInteger)
                    {
                        Engine.put(functionArgumentTable.Name, Convert.ToInt32(((ExprInteger)paramArrayOfExpr[b]).intValue()));
                    }
                    else if (paramArrayOfExpr[b] is ExprBoolean)
                    {
                        Engine.put(functionArgumentTable.Name, Convert.ToBoolean(((ExprBoolean)paramArrayOfExpr[b]).booleanValue()));
                    }
                    else if (paramArrayOfExpr[b] is ExprArray)
                    {
                        Engine.put(functionArgumentTable.Name, ExprArrayUtil.toObjectArray((ExprArray)paramArrayOfExpr[b]));
                    }
                    else
                    {
                        Engine.put(functionArgumentTable.Name, ((ExprString)paramArrayOfExpr[b]).str);
                    }
                }
                b++;
            }
            foreach (FunctionArgumentTable functionArgumentTable in this.constArguments)
            {
                if (paramExprAbstractEvaluationContext.hasAdditionalVariable(this.fTable.Name.ToUpper()))
                {
                    this.previousArgs[functionArgumentTable.Name] = paramExprAbstractEvaluationContext.getAdditionalVariableValue(functionArgumentTable.Name);
                }
                Expr expr = evaluateConstant(paramExprAbstractEvaluationContext, functionArgumentTable);
                paramExprAbstractEvaluationContext.addAdditionalVariable(functionArgumentTable.Name.ToUpper(), expr);
                if (this.jsLanguage)
                {
                    if (expr is ExprDouble)
                    {
                        Engine.put(functionArgumentTable.Name, Convert.ToDouble(((ExprDouble)expr).doubleValue()));
                        continue;
                    }
                    if (expr is ExprInteger)
                    {
                        Engine.put(functionArgumentTable.Name, Convert.ToInt32(((ExprInteger)expr).intValue()));
                        continue;
                    }
                    if (expr is ExprBoolean)
                    {
                        Engine.put(functionArgumentTable.Name, Convert.ToInt32(((ExprBoolean)expr).intValue()));
                        continue;
                    }
                    if (paramArrayOfExpr[b] is ExprArray)
                    {
                        Engine.put(functionArgumentTable.Name, ExprArrayUtil.toObjectArray((ExprArray)paramArrayOfExpr[b]));
                        continue;
                    }
                    Engine.put(functionArgumentTable.Name, ((ExprString)expr).str);
                }
            }
            if (@bool)
            {
                string str = "function " + this.fTable.Name + "() {" + this.fTable.Implementation + "\n}";
                try
                {
                    Engine.eval(str);
                }
                catch (ScriptException scriptException)
                {
                    string str1 = scriptException.Message;
                    if (scriptException.InnerException != null)
                    {
                        str1 = scriptException.InnerException.Message;
                    }
                    if (str1.IndexOf(":", StringComparison.Ordinal) != -1)
                    {
                        str1 = str1.Substring(str1.LastIndexOf(":", StringComparison.Ordinal));
                    }
                    throw new ExprException(str1);
                }
                catch (Exception exception)
                {
                    throw new ExprException(exception.Message);
                }
            }
        }