private TypeSymbol TransformType(TypeSymbol type) { Debug.Assert(_index >= 0); if ( !HasFlag || PeekFlag() && (type.SpecialType != SpecialType.System_Object && !type.IsDynamic()) ) { // Bail, since flags are invalid. return(null); } switch (type.Kind) { case SymbolKind.ErrorType: case SymbolKind.NamedType: if (type.SpecialType == SpecialType.System_Object) { // Replace the given System.Object type with dynamic type if the corresponding dynamicTransformFlag is set to true. return(ConsumeFlag() ? DynamicTypeSymbol.Instance : type); } return(TransformNamedType((NamedTypeSymbol)type)); case SymbolKind.ArrayType: return(TransformArrayType((ArrayTypeSymbol)type)); case SymbolKind.PointerType: return(TransformPointerType((PointerTypeSymbol)type)); case SymbolKind.FunctionPointerType: return(TransformFunctionPointerType((FunctionPointerTypeSymbol)type)); case SymbolKind.DynamicType: Debug.Assert( !_haveCustomModifierFlags, "This shouldn't happen during decoding." ); return(ConsumeFlag() ? type : _containingAssembly.GetSpecialType(SpecialType.System_Object)); default: ConsumeFlag(); return(HandleCustomModifiers(type.CustomModifierCount()) ? type : null); } }
private TypeSymbol TransformType(TypeSymbol type) { Debug.Assert(index >= 0); if (index >= dynamicTransformFlags.Length || dynamicTransformFlags[index] && type.SpecialType != SpecialType.System_Object) { return(null); } switch (type.Kind) { case SymbolKind.ErrorType: case SymbolKind.NamedType: if (type.SpecialType == SpecialType.System_Object) { // Replace the given System.Object type with dynamic type if the corresponding dynamicTransformFlag is set to true. return(dynamicTransformFlags[index++] ? DynamicTypeSymbol.Instance : type); } return(TransformNamedType((NamedTypeSymbol)type)); case SymbolKind.ArrayType: return(TransformArrayType((ArrayTypeSymbol)type)); case SymbolKind.PointerType: return(TransformPointerType((PointerTypeSymbol)type)); case SymbolKind.DynamicType: Debug.Assert(!this.haveCustomModifierFlags, "This shouldn't happen during decoding."); return(dynamicTransformFlags[index++] ? type : this.containingAssembly.GetSpecialType(SpecialType.System_Object)); default: index++; return(HandleCustomModifiers(type.CustomModifierCount()) ? type : null); } }
private TypeSymbol TransformType(TypeSymbol type) { Debug.Assert(_index >= 0); if (!HasFlag || PeekFlag() && type.SpecialType != SpecialType.System_Object) { // Bail, since flags are invalid. return null; } switch (type.Kind) { case SymbolKind.ErrorType: case SymbolKind.NamedType: if (type.SpecialType == SpecialType.System_Object) { // Replace the given System.Object type with dynamic type if the corresponding dynamicTransformFlag is set to true. return ConsumeFlag() ? DynamicTypeSymbol.Instance : type; } return TransformNamedType((NamedTypeSymbol)type); case SymbolKind.ArrayType: return TransformArrayType((ArrayTypeSymbol)type); case SymbolKind.PointerType: return TransformPointerType((PointerTypeSymbol)type); case SymbolKind.DynamicType: Debug.Assert(!_haveCustomModifierFlags, "This shouldn't happen during decoding."); return ConsumeFlag() ? type : _containingAssembly.GetSpecialType(SpecialType.System_Object); default: ConsumeFlag(); return HandleCustomModifiers(type.CustomModifierCount()) ? type : null; } }
private TypeSymbol TransformType(TypeSymbol type) { Debug.Assert(index >= 0); if (index >= dynamicTransformFlags.Length || dynamicTransformFlags[index] && type.SpecialType != SpecialType.System_Object) { return null; } switch (type.Kind) { case SymbolKind.ErrorType: case SymbolKind.NamedType: if (type.SpecialType == SpecialType.System_Object) { // Replace the given System.Object type with dynamic type if the corresponding dynamicTransformFlag is set to true. return dynamicTransformFlags[index++] ? DynamicTypeSymbol.Instance : type; } return TransformNamedType((NamedTypeSymbol)type); case SymbolKind.ArrayType: return TransformArrayType((ArrayTypeSymbol)type); case SymbolKind.PointerType: return TransformPointerType((PointerTypeSymbol)type); case SymbolKind.DynamicType: Debug.Assert(!this.haveCustomModifierFlags, "This shouldn't happen during decoding."); return dynamicTransformFlags[index++] ? type : this.containingAssembly.GetSpecialType(SpecialType.System_Object); default: index++; return HandleCustomModifiers(type.CustomModifierCount()) ? type : null; } }