예제 #1
0
        public bool Equals(TupleErrorFieldSymbol other)
        {
            if ((object)other == this)
            {
                return(true);
            }

            return((object)other != null &&
                   _tupleElementIndex == other._tupleElementIndex &&
                   TypeSymbol.Equals(ContainingType, other.ContainingType, TypeCompareKind.ConsiderEverything2));
        }
예제 #2
0
        public TupleErrorFieldSymbol(
            NamedTypeSymbol container,
            string name,
            int tupleElementIndex,
            Location location,
            TypeSymbolWithAnnotations type,
            DiagnosticInfo useSiteDiagnosticInfo,
            bool isImplicitlyDeclared,
            TupleErrorFieldSymbol correspondingDefaultFieldOpt)

            : base(container, name, isPublic: true, isReadOnly: false, isStatic: false)
        {
            Debug.Assert(name != null);
            _type                  = type;
            _locations             = location == null ? ImmutableArray <Location> .Empty : ImmutableArray.Create(location);
            _useSiteDiagnosticInfo = useSiteDiagnosticInfo;
            _tupleElementIndex     = (object)correspondingDefaultFieldOpt == null ? tupleElementIndex << 1 : (tupleElementIndex << 1) + 1;
            _isImplicitlyDeclared  = isImplicitlyDeclared;

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

            _correspondingDefaultField = correspondingDefaultFieldOpt ?? this;
        }