예제 #1
0
        private IType CreateConcreteCallableType(Node sourceNode, AnonymousCallableType anonymousType)
        {
            Module module = TypeSystemServices.GetCompilerGeneratedTypesModule();

            string          name = string.Format("___callable{0}", module.Members.Count);
            ClassDefinition cd   = TypeSystemServices.CreateCallableDefinition(name);

            cd.Modifiers  |= TypeMemberModifiers.Public;
            cd.LexicalInfo = sourceNode.LexicalInfo;

            cd.Members.Add(CreateInvokeMethod(anonymousType));

            Method beginInvoke = CreateBeginInvokeMethod(anonymousType);

            cd.Members.Add(beginInvoke);

            cd.Members.Add(CreateEndInvokeMethod(anonymousType));
            module.Members.Add(cd);

            CreateCallableTypeBeginInvokeExtensions(anonymousType, beginInvoke);

            return((IType)cd.Entity);
        }