Exemplo n.º 1
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Initialization, oldValue, newValue, n => Initialization = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 2
0
    /// <summary>
    /// By default, and expression can have upto only one user. For multiple users, we will need to introduce temporary WriteIndentifier expressions.
    /// We might have statements (e.g. if) that use the result, so type should be Node and not Expression
    /// </summary>
    public override void AddUser(Node newUser)
    {
      if (User == null)
        base.AddUser(newUser);
      else
      {
        var currUser = User;

        var writeTemp = currUser as WriteTemporaryExpression;
        if (writeTemp == null)
        {
          base.RemoveUser(currUser); //next line will call this.AddUser again, so should null it beforehand
          writeTemp = new WriteTemporaryExpression(this);
          Debug.Assert(User == writeTemp, "Invalid situation!");

          currUser.Replace(this, writeTemp);
          writeTemp.AddUser(currUser);
        }
        else
        {
          //already a temporary is assigned
        }

        newUser.Replace(this, writeTemp);
        writeTemp.AddUser(newUser);
      }
    }
Exemplo n.º 3
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(ThisArg, oldValue, newValue, n => ThisArg = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 4
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Expression, oldValue, newValue, n => Expression = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 5
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Target, oldValue, newValue, n => Target= n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 6
0
    //public BlockStatement()
    //  : this(new List<Statement>())
    //{ }

    public override bool Replace(Node oldValue, Node newValue)
    {
      return
        Replace(Statements, oldValue, newValue)
        ||
        base.Replace(oldValue, newValue);
    }
Exemplo n.º 7
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Value, oldValue, newValue, n => Value = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 8
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Identifier, oldValue, newValue, n => Identifier = n)
     ||
     Replace(Statement, oldValue, newValue, n => Statement = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 9
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Arguments, oldValue, newValue)
     ||
     Replace(Function, oldValue, newValue, n => Function = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 10
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Condition, oldValue, newValue, n => Condition = n)
     ||
     Replace(Body, oldValue, newValue, n => Body = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 11
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   //for (var i = 0; i < CaseClauses.Count; ++i)
   //  if (CaseClauses[i].Replace(oldValue, newValue))
   //    return true;
   return
     Replace(Expression, oldValue, newValue, n => Expression = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 12
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     //The followings cannot be replaces. If this case happened we need to discuss it! 
     //Replace(Expression, oldValue, newValue, n => Expression = n)
     //||
     //Replace(Implementation, oldValue, newValue, n => Implementation = n)
     //||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 13
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return 
     Replace(Expression, oldValue, newValue, n => Expression = n)
     ||
     Replace(Body, oldValue, newValue, n => Body = n)
     ||
     Replace(Comparison, oldValue, newValue, n => Comparison = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 14
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Initialization, oldValue, newValue, n => Initialization = n)
     ||
     Replace(Expression, oldValue, newValue, n => Expression = n)
     ||
     Replace(ExtendedBody, oldValue, newValue, n => ExtendedBody= n)
     ||
     Replace(IteratorInitialization, oldValue, newValue, n => IteratorInitialization = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 15
0
 protected override void Visit(Node node) { }
Exemplo n.º 16
0
      protected void PushLocation(Node node)
      {
#if DEBUG || DIAGNOSE
        if (!JSRuntime.Instance.Configuration.EnableDiagLocation)
          return;
        //Errors may occur both during compilation or execution, so we push location now, and also generate code for execution time
        JSRuntime.PushLocation(_currFuncMetadata, node.SourceOffset);
        if (_ilGen != null)
        {
          Ldarg_func();
          _ilGen.Call(Types.DFunction.GetMetadata);
          _ilGen.Castclass(Types.JSFunctionMetadata.TypeOf);
          _ilGen.Ldc_I4(node.SourceOffset);
          _ilGen.Call(Types.JSRuntime.PushLocation);
        }
#endif
      }
Exemplo n.º 17
0
 internal void PushLocation(Node node)
 {
   //CurrLocations.Push(node);
 }
Exemplo n.º 18
0
 internal void PopLocation(Node node, ref mdr.DValue result)
 {
   //_currProfiler.UpdateProfile(node, result.ValueType);
   //Node n;
   //do
   //{
   //  Debug.Assert(CurrLocations.Count > 0, "invalid situation! location stack is empty, could not fine {0}", node);
   //  n = CurrLocations.Pop();
   //} while (n != node);
   ////Debug.Assert(node == n, "invalid situation! node {0} is different from node {1} on top of stack", node, n);
 }
Exemplo n.º 19
0
 ILGen.BaseILGenerator BeginICMethod(Node node, bool updateIlGen = true) { return BeginICMethod(node.GetType().Name, updateIlGen); }
Exemplo n.º 20
0
 public override void RemoveUser(Node currUser)
 {
   var inTheList = Users.Remove(currUser);
   Debug.Assert(inTheList, "Invalid situation!");
 }
Exemplo n.º 21
0
 public override void AddUser(Node newUser) { Users.Add(newUser); }
Exemplo n.º 22
0
 public override bool IsUsedBy(Node node) { return Users.Contains(node); }