예제 #1
0
 internal void AddType(string name, ReflectedType rt)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException("name");
     }
     if (null == rt)
     {
         throw new ArgumentNullException("rt");
     }
     if (types == null)
     {
         types = new Dictionary <SymbolId, ReflectedType>();
     }
     types[SymbolTable.StringToId(name)] = rt;
 }
예제 #2
0
 internal Inferred InferType(Type type)
 {
     if (type == typeof(int))
     {
         return(inferredInt);
     }
     else if (type == typeof(IronMath.BigInteger))
     {
         return(inferredBgi);
     }
     else if (type == typeof(IronMath.Complex64))
     {
         return(inferredCpx);
     }
     else if (type == typeof(double))
     {
         return(inferredDbl);
     }
     else if (type == typeof(string))
     {
         return(inferredStr);
     }
     else if (type == typeof(IronPython.Runtime.Tuple))
     {
         return(inferredTpl);
     }
     else if (type == typeof(IronPython.Runtime.List))
     {
         return(inferredLst);
     }
     else if (type == typeof(IronPython.Runtime.Dict))
     {
         return(inferredDct);
     }
     else
     {
         ReflectedType rt;
         if (!reflected.TryGetValue(type, out rt))
         {
             rt = new ReflectedType(type);
             reflected[type] = rt;
         }
         return(rt);
     }
 }
예제 #3
0
 internal void AddType(string name, ReflectedType rt)
 {
     if (string.IsNullOrEmpty(name)) {
         throw new ArgumentNullException("name");
     }
     if (null == rt) {
         throw new ArgumentNullException("rt");
     }
     if (types == null) {
         types = new Dictionary<SymbolId, ReflectedType>();
     }
     types[SymbolTable.StringToId(name)] = rt;
 }
예제 #4
0
 public bool TryGetBuiltin(string name, out ReflectedType scope)
 {
     return types.TryGetValue(SymbolTable.StringToId(name), out scope);
 }
예제 #5
0
 internal Inferred InferType(Type type)
 {
     if (type == typeof(int)) {
         return inferredInt;
     } else if (type == typeof(IronMath.BigInteger)) {
         return inferredBgi;
     } else if (type == typeof(IronMath.Complex64)) {
         return inferredCpx;
     } else if (type == typeof(double)) {
         return inferredDbl;
     } else if (type == typeof(string)) {
         return inferredStr;
     } else if (type == typeof(IronPython.Runtime.Tuple)) {
         return inferredTpl;
     } else if (type == typeof(IronPython.Runtime.List)) {
         return inferredLst;
     } else if (type == typeof(IronPython.Runtime.Dict)) {
         return inferredDct;
     } else {
         ReflectedType rt;
         if (!reflected.TryGetValue(type, out rt)) {
             rt = new ReflectedType(type);
             reflected[type] = rt;
         }
         return rt;
     }
 }
예제 #6
0
 public bool TryGetBuiltin(string name, out ReflectedType scope)
 {
     return(types.TryGetValue(SymbolTable.StringToId(name), out scope));
 }