public static IMethodName Method([NotNull] string input) { try { var ctx = TypeNameParseUtil.ValidateMethodName(input); if (ctx.UNKNOWN() != null) { return(UnknownName.Get(typeof(IMethodName))); } return(new MethodName(ctx)); } catch (Exception) { try { var ctx = TypeNameParseUtil.ValidateMethodName(CsNameFixer.HandleOldMethodNames(input)); if (ctx.UNKNOWN() != null) { return(UnknownName.Get(typeof(IMethodName))); } return(new MethodName(ctx)); } catch (Exception) { return(UnknownName.Get(typeof(IMethodName))); } } }
public static IFieldName Field(string input) { var name = GetMemberName(input); if (name != null) { return(name); } return(UnknownName.Get(typeof(IFieldName))); }
public static IPropertyName Property(string input) { var name = GetMemberName(input); if (name != null) { return(name); } return(UnknownName.Get(typeof(IPropertyName))); }
public static IEventName Event(string inputB, params object[] args) { var input = string.Format(inputB, args); var name = GetMemberName(input); if (name != null) { return(name); } return(UnknownName.Get(typeof(IEventName))); }
public static UnknownName Get(Type t) { if (NameCache.ContainsKey(t)) { return(NameCache[t]); } var name = new UnknownName(t); NameCache.Add(t, name); return(name); }
public static IAssemblyName Assembly(string input) { try { var ctx = TypeNameParseUtil.ValidateAssemblyName(input); return(new AssemblyName(ctx)); } catch (Exception) { return(UnknownName.Get(typeof(IAssemblyName))); } }
public static INamespaceName Namespace(string input) { try { var ctx = TypeNameParseUtil.ValidateNamespaceName(input); return(new NamespaceName(ctx)); } catch (Exception) { return(UnknownName.Get(typeof(INamespaceName))); } }
public static IParameterName Parameter(string input) { try { var ctx = TypeNameParseUtil.ValidateParameterName(input); return(new ParameterName(ctx)); } catch (AssertException) { return(UnknownName.Get(typeof(IParameterName))); } }
public static ILambdaName GetLambdaName(string input) { try { var ctx = TypeNameParseUtil.ValidateLambdaName(input); if (ctx.UNKNOWN() != null) { return(UnknownName.Get(typeof(ILambdaName))); } return(new LambdaName(ctx)); } catch (AssertException) { return(UnknownName.Get(typeof(ILambdaName))); } }