public void SetIsMutable(bool value) { if (!value) { throw new System.NotImplementedException(); } var headPat = HeadPattern; if (headPat != null) { FSharpImplUtil.AddTokenBefore(headPat, FSharpTokenType.MUTABLE); } }
public Tuple <ICollection <IDeclaredElement>, bool> GetNavigateToTargets(IDeclaredElement element) { // todo: for union cases navigate to case declarations var resolvedSymbolElement = element as ResolvedFSharpSymbolElement; if (resolvedSymbolElement?.Symbol is FSharpActivePatternCase activePatternCase) { var activePattern = activePatternCase.Group; var entityOption = activePattern.DeclaringEntity; var patternNameOption = activePattern.Name; if (entityOption == null || patternNameOption == null) { return(null); } var typeElement = FSharpElementsUtil.GetTypeElement(entityOption.Value, resolvedSymbolElement.Module); var pattern = typeElement.EnumerateMembers(patternNameOption.Value, true).FirstOrDefault() as IDeclaredElement; if (pattern is IFSharpTypeMember) { var patternDecl = pattern.GetDeclarations().FirstOrDefault(); if (patternDecl == null) { return(null); } var caseElement = FSharpImplUtil.GetActivePatternByIndex(patternDecl, activePatternCase.Index); if (caseElement != null) { return(Tuple.Create(new[] { caseElement }.AsCollection(), false)); } } else if (pattern != null) { return(Tuple.Create(new[] { pattern }.AsCollection(), false)); } } if (!(element is IFSharpTypeMember fsTypeMember) || fsTypeMember.IsVisibleFromFSharp) { return(null); } return(fsTypeMember.GetContainingType() is IDeclaredElement containingType ? Tuple.Create(new[] { containingType }.AsCollection(), false) : null); }
public void SetIsMutable(bool value) { if (value == IsMutable) { return; } if (!value) { throw new System.NotImplementedException(); } var identifier = Identifier; if (identifier != null) { FSharpImplUtil.AddTokenBefore(identifier, FSharpTokenType.MUTABLE); } }
IFSharpReferenceOwner IFSharpReferenceOwner.SetName(string name) => FSharpImplUtil.SetName(this, name);
public NestedModulePart([NotNull] INestedModuleDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, FSharpImplUtil.GetNestedModuleShortName(declaration, cacheBuilder), ModifiersUtil.GetDecoration(declaration.AccessModifiers, declaration.AttributesEnumerable), cacheBuilder) { }