Exemplo n.º 1
0
    override public Symbol Lookup(InputElement id, MessageWriter msg)
    {
        MethodSuite methods = null;
        int         i       = 0;

        for (InterfaceType c = this; c != null; c = i < interfaces.Count ? interfaces[i++] : null)
        {
            Symbol t = c.members[id.str];
            if (t != null && t is MethodSuite)
            {
                if (methods == null)
                {
                    methods = new MethodSuite(t.id);
                }
                // add methods in t to methods
                foreach (Method m in ((MethodSuite)t).methods)
                {
                    if (methods.Contains(m.signature) == null)
                    {
                        methods.Add(m);
                    }
                }
            }
            else if (t != null && methods == null)
            {
                return(t);
            }
        }
        if (methods != null)
        {
            return(methods);
        }
        return(declSpace.Owner.Lookup(id, msg));
    }
Exemplo n.º 2
0
    public virtual Method AddMethod(InputElement id, MessageWriter msg)
    {
        MethodSuite t = members[id.str] as MethodSuite;

        if (t == null)
        {
            t = new MethodSuite(id, members);
            t.Add(id, msg);
        }
        return(t.Add(new Method(id, members)));
    }
Exemplo n.º 3
0
    public virtual Constructor AddConstructor(InputElement id, MessageWriter msg)
    {
        MethodSuite t = members[id.str] as MethodSuite;

        if (t == null)
        {
            t = new MethodSuite(id, members);
            t.Add(id, msg);
        }
        return((Constructor)t.Add(new Constructor(id, members)));
    }
Exemplo n.º 4
0
 public virtual Method FindMethod(string name, params Type[] args)
 {
     for (ClassType c = this; c != null; c = c.baseClass)
     {
         Method      m;
         MethodSuite t = c.members[name] as MethodSuite;
         if (t != null && (m = t.FindMethod(args)) != null)
         {
             return(m);
         }
     }
     return(null);
 }
Exemplo n.º 5
0
    DelegateType GetDelegate(MetaDataTypeDefinition d, SymbolTable bindings, string path)
    {
        DelegateType t = new DelegateType(new InputElement(d.Name), bindings);

        bindings.Add(t.Name, t);
        FillIn(t, d, path);
        MethodSuite m = t.members["Invoke"] as MethodSuite;

        if (m != null && m.Count == 1)
        {
            t.invoke = m[0];
        }
        return(t);
    }
Exemplo n.º 6
0
    DelegateType GetDelegate(System.Type type, SymbolTable bindings)
    {
        string       name = GetName(type);
        DelegateType t    = new DelegateType(new InputElement(name), bindings);

        bindings.Add(t.Name, t);
        FillIn(t, type);
        MethodSuite m = t.members["Invoke"] as MethodSuite;

        if (m != null && m.Count == 1)
        {
            t.invoke = m[0];
        }
        return(t);
    }
Exemplo n.º 7
0
    override public Symbol Lookup(InputElement id, MessageWriter msg)
    {
        MethodSuite methods = null;

        for (ClassType c = this; c != null; c = c.baseClass)
        {
            if (methods == null && id.str == c.id.str)
            {
                return(c);
            }
            Symbol t = c.members[id.str];
            if (t != null && t.Is("override"))
            {
                t = null;
            }
            if (t != null && t is MethodSuite)
            {
                if (methods == null)
                {
                    methods = new MethodSuite(t.id);
                }
                // add methods in t to methods
                foreach (Method m in ((MethodSuite)t).methods)
                {
                    if (methods.Contains(m.signature) == null)
                    {
                        methods.Add(m);
                    }
                }
            }
            else if (t != null && methods == null)
            {
                return(t);
            }
        }
        if (methods != null)
        {
            return(methods);
        }
        return(declSpace.Owner.Lookup(id, msg));
    }