Esempio n. 1
0
 private BoundExpression VisitIndexOrRangePatternIndexerAccess(BoundIndexOrRangePatternIndexerAccess node, bool isLeftOfAssignment)
 {
     if (TypeSymbol.Equals(
             node.Argument.Type,
             _compilation.GetWellKnownType(WellKnownType.System_Index),
             TypeCompareKind.ConsiderEverything))
     {
         return(VisitIndexPatternIndexerAccess(
                    node.Syntax,
                    node.Receiver,
                    node.LengthOrCountProperty,
                    (PropertySymbol)node.PatternSymbol,
                    node.Argument,
                    isLeftOfAssignment: isLeftOfAssignment));
     }
     else
     {
         Debug.Assert(TypeSymbol.Equals(
                          node.Argument.Type,
                          _compilation.GetWellKnownType(WellKnownType.System_Range),
                          TypeCompareKind.ConsiderEverything));
         return(VisitRangePatternIndexerAccess(
                    node.Receiver,
                    node.LengthOrCountProperty,
                    (MethodSymbol)node.PatternSymbol,
                    node.Argument));
     }
 }
 public override BoundNode VisitIndexOrRangePatternIndexerAccess(BoundIndexOrRangePatternIndexerAccess node)
 {
     if (TypeSymbol.Equals(
             node.Argument.Type,
             _compilation.GetWellKnownType(WellKnownType.System_Index),
             TypeCompareKind.ConsiderEverything))
     {
         return(VisitIndexPatternIndexerAccess(
                    node.Receiver,
                    node.LengthOrCountProperty,
                    node.PatternMethod,
                    node.Argument));
     }
     else
     {
         Debug.Assert(TypeSymbol.Equals(
                          node.Argument.Type,
                          _compilation.GetWellKnownType(WellKnownType.System_Range),
                          TypeCompareKind.ConsiderEverything));
         return(VisitRangePatternIndexerAccess(
                    node.Receiver,
                    node.LengthOrCountProperty,
                    node.PatternMethod,
                    node.Argument));
     }
 }
        public override BoundNode VisitIndexOrRangePatternIndexerAccess(BoundIndexOrRangePatternIndexerAccess node)
        {
            if (_inExpressionLambda)
            {
                Error(ErrorCode.ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer, node);
            }

            return(base.VisitIndexOrRangePatternIndexerAccess(node));
        }
        private BoundExpression TransformPatternIndexerAccess(
            BoundIndexOrRangePatternIndexerAccess indexerAccess,
            ArrayBuilder <BoundExpression> stores,
            ArrayBuilder <LocalSymbol> temps,
            bool isDynamicAssignment)
        {
            // A pattern indexer is fundamentally a sequence which ends in either
            // a conventional indexer access or a method call. The lowering of a
            // pattern indexer already lowers everything we need into temps, so
            // the only thing we need to do is lift the stores and temps out of
            // the sequence, and use the final expression as the new argument

            var sequence = VisitIndexOrRangePatternIndexerAccess(indexerAccess, isLeftOfAssignment: true);

            stores.AddRange(sequence.SideEffects);
            temps.AddRange(sequence.Locals);
            return(TransformCompoundAssignmentLHS(sequence.Value, stores, temps, isDynamicAssignment));
        }
Esempio n. 5
0
 public override BoundNode VisitIndexOrRangePatternIndexerAccess(BoundIndexOrRangePatternIndexerAccess node)
 {
     return(VisitIndexOrRangePatternIndexerAccess(node, isLeftOfAssignment: false));
 }