private static bool GetCompiledNameValue(IFSharpAttribute attr, out string compiledName) { // todo: proper expressions evaluation, e.g. "S1" + "S2" if (!attr.ShortNameEquals(CompiledName) || attr.ArgExpression.String == null) { compiledName = null; return(false); } compiledName = attr.ArgExpression.String.GetText() .Substring(1, attr.ArgExpression.String.GetText().Length - 2) .SubstringBeforeLast("`", StringComparison.Ordinal); return(true); }
public static bool ShortNameEquals([NotNull] this IFSharpAttribute attr, [NotNull] string shortName) => attr.LongIdentifier?.Name.GetAttributeShortName()?.Equals(shortName, StringComparison.Ordinal) ?? false;
private static bool IsModuleSuffixAttribute([NotNull] this IFSharpAttribute attr) => attr.ShortNameEquals("CompilationRepresentation") && attr.ArgExpression.LongIdentifier?.QualifiedName == ModuleSuffix;
public static bool ShortNameEquals([NotNull] this IFSharpAttribute attr, [NotNull] string shortName) => attr.GetShortName() == shortName;
public static string GetShortName([NotNull] this IFSharpAttribute attr) => attr.LongIdentifier?.Name.GetAttributeShortName();
public static bool ShortNameEquals([NotNull] this IFSharpAttribute attr, [NotNull] string shortName) => attr.LongIdentifier?.Name.GetAttributeShortName() == shortName;
private static bool IsModuleSuffixAttribute([NotNull] this IFSharpAttribute attr) => attr.ShortNameEquals("CompilationRepresentation") && IsModuleSuffixExpr(attr.Expression);