Beispiel #1
0
        public override FSharpSymbol GetFSharpSymbol()
        {
            var symbolUse = GetSymbolUse();

            if (symbolUse?.Symbol is FSharpField field)
            {
                return(field.DeclaringEntity?.Value);
            }

            // todo: cover other contexts
            var binding = BindingNavigator.GetByExpression(RecordExpr.IgnoreParentParens());

            if (binding == null || !(binding.HeadPattern is INamedPat namedPat))
            {
                return(null);
            }

            var mfv    = namedPat.GetFSharpSymbol() as FSharpMemberOrFunctionOrValue;
            var fsType = mfv?.FullType;

            if (fsType == null || !fsType.HasTypeDefinition)
            {
                return(null);
            }

            var entity = fsType.TypeDefinition;

            return(entity.IsFSharpRecord ? entity : null);
        }
        public override FSharpSymbol GetFSharpSymbol()
        {
            var symbolUse = GetSymbolUse();

            if (symbolUse?.Symbol is FSharpField field)
            {
                return(field.DeclaringEntity?.Value);
            }

            // todo: cover other contexts
            var sequentialExpr = SequentialExprNavigator.GetByExpression(RecordExpr.IgnoreParentParens());

            if (sequentialExpr != null && sequentialExpr.Expressions.Last() != RecordExpr)
            {
                return(null);
            }
            var exprToGetBy = sequentialExpr ?? RecordExpr.IgnoreParentParens();

            var binding = BindingNavigator.GetByExpression(exprToGetBy);

            if (!(binding is { HeadPattern : INamedPat namedPat }))
Beispiel #3
0
        public override FSharpSymbol GetFSharpSymbol()
        {
            var symbolUse = GetSymbolUse();

            if (symbolUse?.Symbol is FSharpField field)
            {
                return(field.DeclaringEntity?.Value);
            }

            // todo: cover other contexts
            var sequentialExpr = SequentialExprNavigator.GetByExpression(RecordExpr.IgnoreParentParens());

            if (sequentialExpr != null && sequentialExpr.Expressions.Last() != RecordExpr)
            {
                return(null);
            }
            var exprToGetBy = sequentialExpr ?? RecordExpr.IgnoreParentParens();

            var binding = BindingNavigator.GetByExpression(exprToGetBy);

            if (binding == null || !(binding.HeadPattern is INamedPat namedPat))
            {
                return(null);
            }

            var mfv = namedPat.GetFSharpSymbol() as FSharpMemberOrFunctionOrValue;
            var returnParameterType = mfv?.ReturnParameter.Type;

            if (returnParameterType == null || !returnParameterType.HasTypeDefinition)
            {
                return(null);
            }

            var entity = returnParameterType.TypeDefinition;

            return(entity.IsFSharpRecord ? entity : null);
        }
Beispiel #4
0
 internal RecordCtorReference([NotNull] RecordExpr owner) : base(owner)
 {
 }