Microsoft.CSharp.RuntimeBinder.Semantics.AggregateSymbol.IsSource C# (CSharp) Метод

IsSource() публичный Метод

public IsSource ( ) : bool
Результат bool
        public bool IsSource()
        {
            return _isSource == true;
        }

Usage Example

Пример #1
0
        /*
         * returns the inputfile where a symbol was declared.
         *
         * returns null for namespaces because they can be declared
         * in multiple files.
         */
        public InputFile getInputFile()
        {
            switch (_kind)
            {
            case SYMKIND.SK_NamespaceSymbol:
            case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol:
                // namespaces don't have input files
                // call with a NamespaceDeclaration instead
                Debug.Assert(false);
                return(null);

            case SYMKIND.SK_NamespaceDeclaration:
                return(null);

            case SYMKIND.SK_AggregateSymbol:
            {
#if !CSEE
                AggregateSymbol AggregateSymbol = this.AsAggregateSymbol();
                if (!AggregateSymbol.IsSource())
                {
                    return(AggregateSymbol.DeclOnly().getInputFile());
                }

                // Because an AggregateSymbol that isn't metadata can be defined across multiple
                // files, getInputFile isn't a reasonable operation.
                Debug.Assert(false);
                return(null);
#endif
            }

            /*
             * case SK_AggregateType:
             *  return ((Symbol)this.AsAggregateType().getAggregate()).getInputFile();
             */

            case SYMKIND.SK_AggregateDeclaration:
                return(this.AsAggregateDeclaration().getInputFile());

            /*
             * case SK_TypeParameterType:
             *  if (this.AsTypeParameterType().GetOwningSymbol().IsAggregateSymbol())
             *  {
             *      ASSERT(0);
             *      return null;
             *  }
             *  else
             *  {
             *      ASSERT(this.AsTypeParameterType().GetOwningSymbol().IsMethodSymbol());
             *      return AsTypeParameterType().GetOwningSymbol().AsMethodSymbol().getInputFile();
             *  }
             */
            case SYMKIND.SK_TypeParameterSymbol:
                if (parent.IsAggregateSymbol())
                {
                    // Because an AggregateSymbol that isn't metadata can be defined across multiple
                    // files, getInputFile isn't a reasonable operation.
                    Debug.Assert(false);
                    return(null);
                }
                else if (parent.IsMethodSymbol())
                {
                    return(parent.AsMethodSymbol().getInputFile());
                }
                Debug.Assert(false);
                break;

            case SYMKIND.SK_FieldSymbol:
                return(this.AsFieldSymbol().containingDeclaration().getInputFile());

            case SYMKIND.SK_MethodSymbol:
                return(this.AsMethodSymbol().containingDeclaration().getInputFile());

            case SYMKIND.SK_PropertySymbol:
                return(this.AsPropertySymbol().containingDeclaration().getInputFile());

            case SYMKIND.SK_EventSymbol:
                return(this.AsEventSymbol().containingDeclaration().getInputFile());

            /*
             * case SK_PointerType:
             * case SK_NullableType:
             * case SK_ArrayType:
             * case SK_PinnedType:
             * case SK_ParameterModifierType:
             * case SK_OptionalModifierType:
             *  return AsType().GetBaseOrParameterOrElementType().getInputFile();
             */

            case SYMKIND.SK_GlobalAttributeDeclaration:
                return(parent.getInputFile());

            /*
             * case SK_NullType:
             * case SK_VoidType:
             *  return null;
             */

            default:
                Debug.Assert(false);
                break;
            }

            return(null);
        }