Exemple #1
0
 internal static CLSMember FindMember0(String name, SymbolTable symtab, String typename, Boolean isStatic)
 {
     Type[] types = symtab.findTypes(typename);
     Exception e = null;
     foreach (Type type in types)
     {
         try
         {
             return FindMember(name, type, isStatic);
         }
         catch (MissingMethodException nie)
         {
             if (e == null) e = nie;
         }
         catch (NotSupportedException nie)
         {
             e = nie;
         }
         catch (Exception nie)
         {
             e = nie;
         }
     }
     throw e ?? new Exception("Can't find " +
                                   (isStatic ? "static" : "instance") +
                                   " member: " + name + " in non Type: " + typename);
 }
Exemple #2
0
 internal static CLSMember FindMember(String name, SymbolTable symtab, String typename, Boolean isStatic)
 {
     if (typename == null)
     {
         return new CLSLateBoundMember(name);
     }
     return new FindMemberLater(name, symtab, typename, isStatic);
 }
Exemple #3
0
    public Interpreter(Interpreter parent)
		{
        this.Parent = parent;
		globalenv = new Env(null,null,null,this);
		reader = new Reader(this);
        symbolTable = new SymbolTable(this);

		Assembly[] asm = AppDomain.CurrentDomain.GetAssemblies();
		foreach(Assembly a in asm)
			{
			addTypesFrom(a);
			}
        addTypesFrom(Assembly.LoadWithPartialName("System.Web"));
		internBuiltins();
		Primitives.internAll(this);
		// MEH: EX was not set to null
		EX.setGlobalValue(null);
		LASTVAL.setGlobalValue(null);
		NEXTLASTVAL.setGlobalValue(null);
		THIRDLASTVAL.setGlobalValue(null);

		//these primitives are here, rather than in Primitives, because their implementation
		//requires calls to gfs bound to symbols		
		Intern("intern",new Function(internf));
		Intern("eval",new Function(evalf));
		Intern("load",new Function(loadf));
		Intern("map->list",new Function(map_to_list));
		Intern("apply",new Function(apply));
		Intern("<",new Function(lt));
		Intern("<=",new Function(lteq));
		Intern(">",new Function(gt));
		Intern(">=",new Function(gteq));
		Intern("==",new Function(eqeq));
		Intern("!=",new Function(noteq));

		strgf = (GenericFunction)intern("str").getGlobalValue();
		get_enum_gf = (GenericFunction)intern("get-enum").getGlobalValue();
		compare_gf = (BinOp)intern("compare").getGlobalValue();

		Intern("interpreter",this);
		}
Exemple #4
0
 public FindMemberLater(string s, SymbolTable symtab, string typename, bool @static)
     : base()
 {
     name = s;
     _Symtab = symtab;
     _Typename = typename;
     if (_Typename == null)
     {
         throw new Exception("No type!");
     }
     _Static = @static;
 }