/// <summary> /// Build implicit ctor or initializer method from given source. /// </summary> /// <param name="element">Element which method is built.</param> /// <param name="sourceCode">Code of method.</param> /// <returns>Built method.</returns> private MethodItem buildFromSource(CodeClass2 element, string sourceCode) { var namespaces = DeclaringAssembly.GetNamespaces(element as CodeElement); var activation = new ParsingActivation(sourceCode, MethodInfo, new string[0], namespaces); RegisterActivation(activation, element as CodeElement); var generator = new SourceMethodGenerator(activation, DeclaringAssembly.ParsingProvider); return(new MethodItem(generator, MethodInfo)); }
/// <summary> /// Arrays the resolver. /// </summary> /// <param name="genericParameter">The generic parameter.</param> /// <returns>System.String.</returns> private string arrayResolver(string genericParameter) { if (genericParameter.EndsWith("[]")) { var itemType = genericParameter.Substring(0, genericParameter.Length - 2); itemType = DeclaringAssembly.TranslatePath(itemType); genericParameter = string.Format("Array<{0},1>", itemType); } return(genericParameter); }