예제 #1
0
 public virtual TypeScope GetInstance(List<TypeScope> gen_args)
 {
     TypeScope ts = new TypeScope(this.kind, this.topScope, this.baseScope);
     ts.original_type = this;
     ts.loc = this.loc;
     for (int i = 0; i < gen_args.Count; i++)
     {
         ts.AddGenericParameter(gen_args[i].si.name);
         ts.AddGenericInstanciation(gen_args[i]);
     }
     ts.si.name = this.si.name;
     ts.documentation = this.documentation;
     ts.si.description = ts.GetDescription();
     if (this.elementType != null)
     {
         ts.elementType = internalInstance(this.elementType, gen_args);
     }
     if (this.indexers != null && this.indexers.Count > 0)
     {
         ts.indexers = new List<TypeScope>();
         for (int j = 0; j < this.indexers.Count; j++)
             ts.indexers.Add(internalInstance(this.indexers[j], gen_args));
     }
     Hashtable procs = new Hashtable();
     for (int i = 0; i < members.Count; i++)
     {
         SymScope ss = members[i];
         ts.members.Add(ss);
         if (ss is ElementScope)
         {
             ElementScope es = ss as ElementScope;
             ElementScope new_es = new ElementScope(new SymInfo(es.si.name, es.si.kind, es.si.name), es.sc, ts);
             ts.members[i] = new_es;
             new_es.loc = es.loc;
             new_es.documentation = es.documentation;
             new_es.si.acc_mod = es.si.acc_mod;
             new_es.si.has_doc = es.si.has_doc;
             if (es.indexers != null && es.indexers.Count > 0)
             {
                 new_es.indexers = new List<TypeScope>();
                 for (int j = 0; j < es.indexers.Count; j++)
                     new_es.indexers.Add(internalInstance(es.indexers[j], gen_args));
             }
             if (es.elementType != null)
             {
                 new_es.elementType = internalInstance(es.elementType, gen_args);
             }
             new_es.sc = internalInstance(es.sc as TypeScope, gen_args);
             new_es.MakeDescription();
         }
         else if (ss is ProcScope)
         {
             ProcScope ps = ss as ProcScope;
             ProcScope new_proc = new ProcScope(ps.si.name, ts, ps.is_constructor);
             procs[ps] = new_proc;
             new_proc.loc = ps.loc;
             new_proc.documentation = ps.documentation;
             new_proc.si.acc_mod = ps.si.acc_mod;
             new_proc.is_static = ps.is_static;
             new_proc.is_virtual = ps.is_virtual;
             new_proc.is_abstract = ps.is_abstract;
             new_proc.is_override = ps.is_override;
             new_proc.is_reintroduce = ps.is_reintroduce;
             ts.members[i] = new_proc;
             if (ps.parameters != null)
                 for (int j = 0; j < ps.parameters.Count; j++)
                 {
                     ElementScope es = ps.parameters[j];
                     ElementScope es2 = new ElementScope(new SymInfo(es.si.name, es.si.kind, es.si.name), es.sc, new_proc);
                     es2.loc = es.loc;
                     es2.cnst_val = es.cnst_val;
                     es2.si.acc_mod = es.si.acc_mod;
                     es2.param_kind = es.param_kind;
                     es2.sc = internalInstance(es.sc as TypeScope, gen_args);
                     es2.MakeDescription();
                     new_proc.AddParameter(es2);
                 }
             new_proc.return_type = internalInstance(ps.return_type, gen_args);
             new_proc.Complete();
         }
     }
     foreach (ProcScope ps in procs.Keys)
     {
         ProcScope new_ps = procs[ps] as ProcScope;
         if (ps.nextProc != null && procs[ps.nextProc] != null)
         {
             new_ps.nextProc = procs[ps.nextProc] as ProcScope;
         }
     }
     return ts;
 }
예제 #2
0
 protected virtual TypeScope simpleGetInstance(List<TypeScope> gen_args)
 {
     TypeScope ts = new TypeScope(this.kind, this.topScope, this.baseScope);
     ts.original_type = this;
     ts.loc = this.loc;
     for (int i = 0; i < gen_args.Count; i++)
     {
         ts.AddGenericParameter(gen_args[i].si.name);
         ts.AddGenericInstanciation(gen_args[i]);
     }
     ts.si.name = this.si.name;
     ts.documentation = this.documentation;
     ts.si.description = ts.GetDescription();
     return ts;
 }