예제 #1
0
파일: CliClass.cs 프로젝트: elasota/clarity
        private CliInterfaceImpl ResolveInterfaceImpl(Compiler compiler, HighInterfaceImplementation highIfcImpl)
        {
            CliInterface ifc = compiler.GetClosedInterface(highIfcImpl.Interface);

            CliInterfaceImplSlot[] slots = new CliInterfaceImplSlot[ifc.Slots.Length];

            foreach (HighInterfaceMethodImplementation methodImpl in highIfcImpl.MethodImpls)
            {
                uint classIndex;
                if (!m_declTagToVTableSlot.TryGetValue(methodImpl.ClassSlot, out classIndex))
                    throw new Exception("Couldn't map class vtable slot to interface slot");

                uint ifcIndex = ifc.CliSlotForSlotTag(methodImpl.InterfaceSlot);
                if (slots[ifcIndex].HaveNewImpl)
                    throw new Exception("Interface method implemented multiple times");
                slots[ifcIndex] = new CliInterfaceImplSlot(true, classIndex);
            }

            return new CliInterfaceImpl(highIfcImpl.Interface, slots.ToArray());
        }
예제 #2
0
 public CliInterfaceImpl(TypeSpecClassTag ifc, CliInterfaceImplSlot[] ifcSlotToClassVtableSlot)
 {
     m_interface = ifc;
     m_ifcSlotToClassVtableSlot = ifcSlotToClassVtableSlot;
 }