예제 #1
0
 public dynamic this[Symbol sym] {
     get { return(Resolve(sym, this)); }
     set {
         var val = value;
         if (val is string)
         {
             val = new NovaString(val);
         }
         if (NovaNumber.IsConvertable(val))
         {
             val = new NovaNumber(val);
         }
         SymVars[sym] = val;
     }
 }
예제 #2
0
 public dynamic this[string name] {
     get { return(Resolve(name)); }
     set {
         if (CheckConstant(name))
         {
             throw new ConstantException(
                       string.Format("{0} is already defined as a constant in this scope or a parent scope.", name));
         }
         var val = value;
         if (val is string)
         {
             val = new NovaString(val);
         }
         if (NovaNumber.IsConvertable(val))
         {
             val = new NovaNumber(val);
         }
         Variables[name] = val;
     }
 }