private ProtoCore.AST.AssociativeAST.AssociativeNode ParseMethod(MethodInfo method) { ProtoCore.Type retype = CLRModuleType.GetProtoCoreType(method.ReturnType, Module); bool propaccessor = isPropertyAccessor(method); bool isOperator = isOverloadedOperator(method); FFIMethodAttributes mattrs = new FFIMethodAttributes(method); if (method.IsStatic && method.DeclaringType == method.ReturnType && !propaccessor && !isOperator) { //case for named constructor. Must return a pointer type if (!Object.Equals(method.ReturnType, CLRType)) { throw new InvalidOperationException("Unexpected type for constructor {0D28FC00-F8F4-4049-AD1F-BBC34A68073F}"); } retype = ProtoCoreType; ConstructorDefinitionNode node = ParsedNamedConstructor(method, method.Name, retype); node.MethodAttributes = mattrs; return(node); } //Need to hide property accessor from design script users, prefix with % string prefix = (isOperator || propaccessor) ? "%" : ""; var func = new ProtoCore.AST.AssociativeAST.FunctionDefinitionNode(); if (isOperator) { func.Name = string.Format("{0}{1}", prefix, GetDSOperatorName(method.Name)); } else { func.Name = string.Format("{0}{1}", prefix, method.Name); } func.Pattern = null; func.Signature = ParseArgumentSignature(method); if ((retype.IsIndexable && mattrs.AllowRankReduction) || (typeof(object).Equals(method.ReturnType))) { retype.rank = Constants.kArbitraryRank; } func.ReturnType = retype; func.FunctionBody = null; func.access = ProtoCore.Compiler.AccessSpecifier.kPublic; func.IsDNI = false; func.IsExternLib = true; func.ExternLibName = Module.Name; func.IsStatic = method.IsStatic; func.MethodAttributes = mattrs; return(func); }
private ProtoCore.AST.AssociativeAST.AssociativeNode ParseMethod(MethodInfo method) { ProtoCore.Type retype = CLRModuleType.GetProtoCoreType(method.ReturnType, Module); bool propaccessor = isPropertyAccessor(method); bool isOperator = isOverloadedOperator(method); FFIMethodAttributes mattrs = new FFIMethodAttributes(method); if (method.IsStatic && method.DeclaringType == method.ReturnType && !propaccessor && !isOperator) { //case for named constructor. Must return a pointer type if (!Object.Equals(method.ReturnType, CLRType)) throw new InvalidOperationException("Unexpected type for constructor {0D28FC00-F8F4-4049-AD1F-BBC34A68073F}"); retype = ProtoCoreType; ConstructorDefinitionNode node = ParsedNamedConstructor(method, method.Name, retype); node.MethodAttributes = mattrs; return node; } //Need to hide property accessor from design script users, prefix with % string prefix = (isOperator || propaccessor) ? "%" : ""; var func = new ProtoCore.AST.AssociativeAST.FunctionDefinitionNode(); if (isOperator) { func.Name = string.Format("{0}{1}", prefix, GetDSOperatorName(method.Name)); } else { func.Name = string.Format("{0}{1}", prefix, method.Name); } func.Pattern = null; func.Signature = ParseArgumentSignature(method); if ((retype.IsIndexable && mattrs.AllowRankReduction) || (typeof(object).Equals(method.ReturnType))) { retype.rank = Constants.kArbitraryRank; } func.ReturnType = retype; func.FunctionBody = null; func.access = ProtoCore.Compiler.AccessSpecifier.kPublic; func.IsDNI = false; func.IsExternLib = true; func.ExternLibName = Module.Name; func.IsStatic = method.IsStatic; func.MethodAttributes = mattrs; return func; }