예제 #1
0
        IType GetExtendedMacroType(IMethod method)
        {
            InternalMethod internalMethod = method as InternalMethod;

            if (null != internalMethod)
            {
                Method extension = internalMethod.Method;
                if (!extension.Attributes.Contains(Types.CompilerGeneratedAttribute.FullName))
                {
                    return(null);
                }
                SimpleTypeReference sref = extension.Parameters[0].Type as SimpleTypeReference;
                if (null != sref && extension.Parameters.Count == 2)
                {
                    IType type = NameResolutionService.ResolveQualifiedName(sref.Name) as IType;
                    if (type != null && type.Name.EndsWith("Macro"))                     //no entity yet
                    {
                        return(type);
                    }
                }
            }
            else if (method is ExternalMethod && method.IsExtension)
            {
                var parameters = method.GetParameters();
                if (parameters.Length == 2 && TypeSystemServices.IsMacro(parameters[0].Type))
                {
                    return(parameters[0].Type);
                }
            }
            return(null);
        }