示例#1
0
        private void updateParent(ref SchemeAST currentAST, SchemeObject newValue)
        {
            /*   if (currentAST.currentObject.GetType() == typeof(SchemeLambda))
               {
                   //  foreach (SchemeType obj in currrentEn )
                   foreach (string key in currentEnvironment.getDict().Keys)
                   {
                       currentEnvironment.parent().set(new SchemeSymbol(key), currentEnvironment.getDict()[key]);
                   }
               } */
            if (currentAST.hasOwnEnviornment)// && currentEnvironment.parent() != null )
            {
                /* if (newValue is SchemeLambda)
                 {
                     foreach (string key in currentEnvironment.getDict().Keys)
                     {
                         currentEnvironment.parent().set(new SchemeSymbol(key), currentEnvironment.getDict()[key]);
                     }
                 }           */
                currentEnvironment = currentEnvironment.parent();
            }

            int postition = currentAST.parent.children.IndexOf(currentAST);
            currentAST.parent.children.Remove(currentAST);
            // if(  newValue != SchemeVoid.instance )
            //  {
            var returnValue = new SchemeAST(currentAST.parent, newValue);
            currentAST.parent.children.Insert(postition, returnValue);
            //  }
        }
示例#2
0
 public SchemeList(SchemeObject car)
 {
     this.car = car;
     this.cdr = SchemeNil.instance;
 }
示例#3
0
 public SchemeAST( SchemeAST parent, SchemeObject currentObject )
 {
     // Debug.Assert( parent != null && currentObject != null );
     _parent = parent;
     this.currentObject = currentObject;
 }
示例#4
0
 public SchemeList(SchemeObject foo, SchemeObject bar)
 {
     this.car = foo;
     this.cdr = bar;
 }