Beispiel #1
0
        public CallExpression MakeCallExpression(Scope scope, IExpression function, IExpressionList arguments)
        {
            scope.HasCall = true;

            ///We have to detect the followings immediately now, before future phases modify the IR

            var func = MakeToFunction((Expression)function); //This will ensure we have uniform type going forward

            Expression thisArg          = null;
            bool       isDirectEvalCall = false;

            var funcExp = GetEquivalent(func.Expression);

            var indexer = funcExp as ReadIndexerExpression;

            if (indexer != null)
            {
                thisArg = indexer.Container;
            }
            else
            {
                var id = funcExp as ReadIdentifierExpression;
                Debug.WriteLineIf(id == null, "Runtime error or coding error?");
                isDirectEvalCall = (id != null && id.Symbol != null && id.Symbol.Name == "eval");
                if (isDirectEvalCall)
                {
                    scope.HasEval = isDirectEvalCall; //We have to be carefull not to over write the old value!
                }
            }

            var n = new CallExpression(func, thisArg, arguments, isDirectEvalCall);

            scope.Invocations.Add(n);
            return(n);
        }
Beispiel #2
0
        public NewExpression MakeNewExpression(Scope scope, IExpression function, IExpressionList arguments = null)
        {
            scope.HasCall = true;
            var n = new NewExpression(MakeToFunction((Expression)function), arguments ?? MakeExpressionList());

            scope.Invocations.Add(n);
            return(n);
        }
Beispiel #3
0
 public static ExpressionTableArgs ToTableArgs(IExpressionList list)
 {
     return(list.Count > 0 ? list[0].Cast <ExpressionTableArgs>() : _tableArgs);
 }
Beispiel #4
0
 public static ExpressionArrayArgs ToArrayArgs(IExpressionList list)
 {
     return(list.Count > 0 ? list[0].Cast <ExpressionArrayArgs>() : _arrayArgs);
 }
Beispiel #5
0
 public static ExpressionStringArgs ToStringArgs(IExpressionList list)
 {
     return(list.Count > 0 ? list[0].Cast <ExpressionStringArgs>() : _stringArgs);
 }
Beispiel #6
0
    public CallExpression MakeCallExpression(Scope scope, IExpression function, IExpressionList arguments)
    {
      scope.HasCall = true;

      ///We have to detect the followings immediately now, before future phases modify the IR

      var func = MakeToFunction((Expression)function); //This will ensure we have uniform type going forward

      Expression thisArg = null;
      bool isDirectEvalCall = false;

      var funcExp = GetEquivalent(func.Expression);

      var indexer = funcExp as ReadIndexerExpression;
      if (indexer != null)
      {
        thisArg = indexer.Container;
      }
      else
      {
        var id = funcExp as ReadIdentifierExpression;
        Debug.WriteLineIf(id == null, "Runtime error or coding error?");
        isDirectEvalCall = (id != null && id.Symbol != null && id.Symbol.Name == "eval");
        if (isDirectEvalCall)
          scope.HasEval = isDirectEvalCall; //We have to be carefull not to over write the old value!
      }

      var n = new CallExpression(func, thisArg, arguments, isDirectEvalCall);
      scope.Invocations.Add(n);
      return n;
    }
Beispiel #7
0
 public NewExpression MakeNewExpression(Scope scope, IExpression function, IExpressionList arguments = null)
 {
   scope.HasCall = true;
   var n = new NewExpression(MakeToFunction((Expression)function), arguments ?? MakeExpressionList());
   scope.Invocations.Add(n);
   return n;
 }
Beispiel #8
0
 public Module(IExpressionList list)
 {
     _list = list;
     Checking();
 }
 /// <summary>
 /// Processes the specified list.
 /// </summary>
 /// <param name="list">The list.</param>
 private void Process(IExpressionList<IExpressionQueueItem> list)
 {
     if (list.Count > 0)
     {
         foreach (var item in list)
         {
             this.Dequeue(item);
         }
     }
 }
        /// <summary>
        /// Watches the queue.
        /// </summary>
        public void WatchQueue()
        {
            if (this.Monitor.RequestMode == RequestMode.PublishSubscribe)
            {
                if (ExpreessionItemList == null) ExpreessionItemList = TheDataProvider.GetList();
                this.Process(ExpreessionItemList); //process existing records

                ExpreessionItemList.NewMessage += this.NotifierNewMessage;
                ExpreessionItemList.RegisterDependencies(); // Setup notifications
            }
            else
            {
                TheExpressionQueueScreener.Value.ScreenExpressionQueue(list => Process(list));
            }
        }