예제 #1
0
        public TupleElementFieldSymbol(
            TupleTypeSymbol container,
            FieldSymbol underlyingField,
            int tupleElementIndex,
            Location location,
            bool isImplicitlyDeclared,
            TupleElementFieldSymbol correspondingDefaultFieldOpt)

            : base(container, underlyingField, (object)correspondingDefaultFieldOpt == null ? tupleElementIndex << 1 : (tupleElementIndex << 1) + 1)
        {
            _locations            = location == null ? ImmutableArray <Location> .Empty : ImmutableArray.Create(location);
            _isImplicitlyDeclared = isImplicitlyDeclared;

            Debug.Assert((correspondingDefaultFieldOpt == null) == this.IsDefaultTupleElement);
            Debug.Assert(correspondingDefaultFieldOpt == null || correspondingDefaultFieldOpt.IsDefaultTupleElement);

            _correspondingDefaultField = correspondingDefaultFieldOpt ?? this;
        }
예제 #2
0
        private readonly bool _cannotUse; // With LanguageVersion 7, we will produce named elements that should not be used

        public TupleVirtualElementFieldSymbol(
            TupleTypeSymbol container,
            FieldSymbol underlyingField,
            string name,
            int tupleElementIndex,
            Location location,
            bool cannotUse,
            bool isImplicitlyDeclared,
            TupleElementFieldSymbol correspondingDefaultFieldOpt)

            : base(container, underlyingField, tupleElementIndex, location, isImplicitlyDeclared, correspondingDefaultFieldOpt)
        {
            Debug.Assert(name != null);
            Debug.Assert(name != underlyingField.Name || !container.UnderlyingNamedType.Equals(underlyingField.ContainingType, TypeCompareKind.IgnoreDynamicAndTupleNames),
                         "fields that map directly to underlying should not be represented by " + nameof(TupleVirtualElementFieldSymbol));

            _name      = name;
            _cannotUse = cannotUse;
        }