internal PrivateImplementationDetails( Cci.IModule module, int submissionSlotIndex, Cci.ITypeReference systemObject, Cci.ITypeReference systemValueType, Cci.ITypeReference systemInt8Type, Cci.ITypeReference systemInt16Type, Cci.ITypeReference systemInt32Type, Cci.ITypeReference systemInt64Type, Cci.ICustomAttribute compilerGeneratedAttribute) { Debug.Assert(module != null); Debug.Assert(systemObject != null); Debug.Assert(systemValueType != null); this.module = module; this.systemObject = systemObject; this.systemValueType = systemValueType; this.systemInt8Type = systemInt8Type; this.systemInt16Type = systemInt16Type; this.systemInt32Type = systemInt32Type; this.systemInt64Type = systemInt64Type; this.compilerGeneratedAttribute = compilerGeneratedAttribute; this.name = GetClassName(submissionSlotIndex); }
internal PrivateImplementationDetails( Cci.IModule moduleBuilder, string moduleName, int submissionSlotIndex, Cci.ITypeReference systemObject, Cci.ITypeReference systemValueType, Cci.ITypeReference systemInt8Type, Cci.ITypeReference systemInt16Type, Cci.ITypeReference systemInt32Type, Cci.ITypeReference systemInt64Type, Cci.ICustomAttribute compilerGeneratedAttribute) { Debug.Assert(systemObject != null); Debug.Assert(systemValueType != null); _moduleBuilder = moduleBuilder; _systemObject = systemObject; _systemValueType = systemValueType; _systemInt8Type = systemInt8Type; _systemInt16Type = systemInt16Type; _systemInt32Type = systemInt32Type; _systemInt64Type = systemInt64Type; _compilerGeneratedAttribute = compilerGeneratedAttribute; var isNetModule = moduleBuilder.AsAssembly == null; _name = GetClassName(moduleName, submissionSlotIndex, isNetModule); }
public MetadataConstant(Cci.ITypeReference type, object value) { Debug.Assert(type != null); AssertValidConstant(value); this.type = type; this.value = value; }
internal SynthesizedStaticField(string name, Cci.INamedTypeDefinition containingType, Cci.ITypeReference type) { Debug.Assert(name != null); Debug.Assert(containingType != null); Debug.Assert(type != null); _containingType = containingType; _type = type; _name = name; }
public abstract LocalDefinition?GetPreviousLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string?name, SynthesizedLocalKind kind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <bool> dynamicTransformFlags, ImmutableArray <string> tupleElementNames);
public EncHoistedLocalMetadata(string name, Cci.ITypeReference type, SynthesizedLocalKind synthesizedKind) { Debug.Assert(name != null); Debug.Assert(type != null); Debug.Assert(synthesizedKind.IsLongLived()); this.Name = name; this.Type = type; this.SynthesizedKind = synthesizedKind; }
public abstract LocalDefinition GetPreviousLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string nameOpt, SynthesizedLocalKind kind, LocalDebugId id, uint pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags);
private static void VisitTypeReference(Cci.ITypeReference typeReference, EmitContext context) { RoslynDebug.Assert(typeReference != null); Cci.IArrayTypeReference?arrayType = typeReference as Cci.IArrayTypeReference; if (arrayType != null) { VisitTypeReference(arrayType.GetElementType(context), context); return; } Cci.IPointerTypeReference?pointerType = typeReference as Cci.IPointerTypeReference; if (pointerType != null) { VisitTypeReference(pointerType.GetTargetType(context), context); return; } //Cci.IManagedPointerTypeReference managedPointerType = typeReference as Cci.IManagedPointerTypeReference; //if (managedPointerType != null) //{ // VisitTypeReference(managedPointerType.GetTargetType(this.context)); // return; //} Cci.IModifiedTypeReference?modifiedType = typeReference as Cci.IModifiedTypeReference; if (modifiedType != null) { VisitCustomModifiers(modifiedType.CustomModifiers, context); VisitTypeReference(modifiedType.UnmodifiedType, context); return; } // Visit containing type Cci.INestedTypeReference?nestedType = typeReference.AsNestedTypeReference; if (nestedType != null) { VisitTypeReference(nestedType.GetContainingType(context), context); } // Visit generic arguments Cci.IGenericTypeInstanceReference?genericInstance = typeReference.AsGenericTypeInstanceReference; if (genericInstance != null) { foreach (var arg in genericInstance.GetGenericArguments(context)) { VisitTypeReference(arg, context); } } if (typeReference is Cci.IFunctionPointerTypeReference functionPointer) { VisitSignature(functionPointer.Signature, context); } }
public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, DiagnosticBag diagnostics, out int slotIndex) { // The previous method was not a state machine (it is allowed to change non-state machine to a state machine): if (_awaiterMap == null) { slotIndex = -1; return(false); } return(_awaiterMap.TryGetValue(_symbolMap.MapReference(currentType), out slotIndex)); }
internal Cci.IFieldReference GetModuleVersionId(Cci.ITypeReference mvidType) { if (_mvidField == null) { Debug.Assert(!IsFrozen); Interlocked.CompareExchange(ref _mvidField, new ModuleVersionIdField(this, mvidType), null); } Debug.Assert(_mvidField.Type.Equals(mvidType)); return(_mvidField); }
private static void VisitTypeReference(Cci.ITypeReference typeReference, EmitContext context) { Debug.Assert(typeReference != null); Cci.IArrayTypeReference arrayType = typeReference as Cci.IArrayTypeReference; if (arrayType != null) { VisitTypeReference(arrayType.GetElementType(context), context); return; } Cci.IPointerTypeReference pointerType = typeReference as Cci.IPointerTypeReference; if (pointerType != null) { VisitTypeReference(pointerType.GetTargetType(context), context); return; } Debug.Assert(!(typeReference is Cci.IManagedPointerTypeReference)); //Cci.IManagedPointerTypeReference managedPointerType = typeReference as Cci.IManagedPointerTypeReference; //if (managedPointerType != null) //{ // VisitTypeReference(managedPointerType.GetTargetType(this.context)); // return; //} Cci.IModifiedTypeReference modifiedType = typeReference as Cci.IModifiedTypeReference; if (modifiedType != null) { foreach (var custModifier in modifiedType.CustomModifiers) { VisitTypeReference(custModifier.GetModifier(context), context); } VisitTypeReference(modifiedType.UnmodifiedType, context); return; } // Visit containing type Cci.INestedTypeReference nestedType = typeReference.AsNestedTypeReference; if (nestedType != null) { VisitTypeReference(nestedType.GetContainingType(context), context); } // Visit generic arguments Cci.IGenericTypeInstanceReference genericInstance = typeReference.AsGenericTypeInstanceReference; if (genericInstance != null) { foreach (var arg in genericInstance.GetGenericArguments(context)) { VisitTypeReference(arg, context); } } }
internal void OpenLocalScope(ScopeType scopeType = ScopeType.Variable, Cci.ITypeReference exceptionType = null) { if (scopeType == ScopeType.TryCatchFinally && IsJustPastLabel()) { DefineHiddenSequencePoint(); EmitOpCode(ILOpCode.Nop); } if (scopeType == ScopeType.Finally) { // WORKAROUND: // This is a workaround to an unexpected consequence of a CLR update that causes try nested in finally not verify // if there is no code before try. ( DevDiv: 563799 ) // If we will treat finally as a label, the code above will force a nop before try starts. _instructionCountAtLastLabel = _emitState.InstructionsEmitted; } EndBlock(); //blocks should not cross scope boundaries. var scope = _scopeManager.OpenScope(scopeType, exceptionType); // Exception handler scopes must have a leader block, even // if the exception handler is empty, and created before any // other block (before nested scope blocks in particular). switch (scopeType) { case ScopeType.Try: Debug.Assert(!_pendingBlockCreate); _pendingBlockCreate = true; break; case ScopeType.Catch: case ScopeType.Filter: case ScopeType.Finally: case ScopeType.Fault: Debug.Assert(!_pendingBlockCreate); _pendingBlockCreate = true; // this is the actual start of the handler. // since it is reachable by an implicit jump (via exception handling) // we need to put a hidden point to ensure that debugger does not associate // this location with some previous sequence point DefineHiddenSequencePoint(); break; case ScopeType.Variable: case ScopeType.TryCatchFinally: case ScopeType.StateMachineVariable: break; default: throw ExceptionUtilities.UnexpectedValue(scopeType); } }
public override Cci.ITypeReference MapReference(Cci.ITypeReference reference) { var symbol = reference as Symbol; if ((object)symbol != null) { return((Cci.ITypeReference)_symbols.Visit(symbol)); } return(null); }
internal Cci.IFieldReference CreateDataField(ImmutableArray <byte> data) { Debug.Assert(!IsFrozen); Cci.ITypeReference type = _proxyTypes.GetOrAdd((uint)data.Length, GetStorageStruct); return(_mappedFields.GetOrAdd(data, data0 => { var name = GenerateDataFieldName(data0); var newField = new MappedField(name, this, type, data0); return newField; })); }
public EncLocalInfo(byte[] signature) { Debug.Assert(signature != null); Debug.Assert(signature.Length > 0); this.SlotInfo = new LocalSlotDebugInfo(SynthesizedLocalKind.EmitterTemp, LocalDebugId.None); this.Type = null; this.Constraints = default(LocalSlotConstraints); this.Signature = signature; this.isUnused = true; }
private LocalDefinition DeclareLocalImpl( Cci.ITypeReference type, ILocalSymbolInternal?symbol, string?name, SynthesizedLocalKind kind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <bool> dynamicTransformFlags, ImmutableArray <string> tupleElementNames) { if (_lazyAllLocals == null) { _lazyAllLocals = new ArrayBuilder <Cci.ILocalDefinition>(1); } LocalDefinition?local; if (symbol != null && _slotAllocator != null) { local = _slotAllocator.GetPreviousLocal( type, symbol, name, kind, id, pdbAttributes, constraints, dynamicTransformFlags: dynamicTransformFlags, tupleElementNames: tupleElementNames); if (local != null) { int slot = local.SlotIndex; _lazyAllLocals[slot] = local; return(local); } } local = new LocalDefinition( symbolOpt: symbol, nameOpt: name, type: type, slot: _lazyAllLocals.Count, synthesizedKind: kind, id: id, pdbAttributes: pdbAttributes, constraints: constraints, dynamicTransformFlags: dynamicTransformFlags, tupleElementNames: tupleElementNames); _lazyAllLocals.Add(local); return(local); }
internal Cci.IFieldReference GetModuleVersionId( Cci.ITypeReference mvidType, TSyntaxNode syntaxOpt, DiagnosticBag diagnostics ) { PrivateImplementationDetails details = GetPrivateImplClass(syntaxOpt, diagnostics); EnsurePrivateImplementationDetailsStaticConstructor(details, syntaxOpt, diagnostics); return(details.GetModuleVersionId(mvidType)); }
public override LocalDefinition GetPreviousLocal( Cci.ITypeReference currentType, ILocalSymbolInternal currentLocalSymbol, string nameOpt, SynthesizedLocalKind kind, LocalDebugId id, uint pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags) { if (id.IsNone) { return(null); } LocalDebugId previousId; if (!TryGetPreviousLocalId(currentLocalSymbol.GetDeclaratorSyntax(), id, out previousId)) { return(null); } var previousType = _symbolMap.MapReference(currentType); if (previousType == null) { return(null); } // TODO (bug #781309): Should report a warning if the type of the local has changed // and the previous value will be dropped. var localKey = new EncLocalInfo(new LocalSlotDebugInfo(kind, previousId), previousType, constraints, signature: null); int slot; if (!_previousLocalSlots.TryGetValue(localKey, out slot)) { return(null); } return(new LocalDefinition( currentLocalSymbol, nameOpt, currentType, slot, kind, id, pdbAttributes, constraints, isDynamic, dynamicTransformFlags)); }
internal MappedField(string name, Cci.INamedTypeDefinition containingType, Cci.ITypeReference type, ImmutableArray <byte> block) { Debug.Assert(name != null); Debug.Assert(containingType != null); Debug.Assert(type != null); Debug.Assert(!block.IsDefault); _containingType = containingType; _type = type; _block = block; _name = name; }
public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, DiagnosticBag diagnostics, out int slotIndex) { // Well-formed state machine attribute wasn't found in the baseline (the type is missing or bad). // Should rarely happen since the IDE reports a rude edit if the attribute type doesn't exist. if (_awaiterMapOpt == null) { ReportMissingStateMachineAttribute(diagnostics); slotIndex = -1; return(false); } return(_awaiterMapOpt.TryGetValue(_symbolMap.MapReference(currentType), out slotIndex)); }
internal Cci.IFieldReference GetInstrumentationPayloadRoot( int analysisKind, Cci.ITypeReference payloadType, TSyntaxNode syntaxOpt, DiagnosticBag diagnostics ) { PrivateImplementationDetails details = GetPrivateImplClass(syntaxOpt, diagnostics); EnsurePrivateImplementationDetailsStaticConstructor(details, syntaxOpt, diagnostics); return(details.GetOrAddInstrumentationPayloadRoot(analysisKind, payloadType)); }
public EncLocalInfo( LocalSlotDebugInfo slotInfo, Cci.ITypeReference type, LocalSlotConstraints constraints, byte[]?signature ) { SlotInfo = slotInfo; Type = type; Constraints = constraints; Signature = signature; IsUnused = false; }
public ImmutableArray <Cci.IMetadataNamedArgument> GetNamedArguments(EmitContext context) { // Perform fixup Cci.ITypeReference stringType = context.Module.GetPlatformType(Cci.PlatformType.SystemString, context); #if DEBUG // Must have exactly 1 named argument. var namedArgs = _sourceAttribute.GetNamedArguments(context); Debug.Assert(namedArgs.Length == 1); // Named argument must be 'File' property of string type var fileArg = namedArgs.First(); Debug.Assert(fileArg.ArgumentName == FilePropertyName); Debug.Assert(context.Module.IsPlatformType(fileArg.Type, Cci.PlatformType.SystemString)); // Named argument value must be a non-empty string Debug.Assert(fileArg.ArgumentValue is MetadataConstant); var fileName = (string?)((MetadataConstant)fileArg.ArgumentValue).Value; Debug.Assert(!String.IsNullOrEmpty(fileName)); // PermissionSetAttribute type must have a writable public string type property member 'Hex' ISymbol iSymbol = ((ISymbolInternal)_sourceAttribute.GetType(context)).GetISymbol(); Debug.Assert(((INamedTypeSymbol)iSymbol).GetMembers(HexPropertyName).Any( member => member.Kind == SymbolKind.Property && ((IPropertySymbol)member).Type.SpecialType == SpecialType.System_String)); #endif string hexFileContent; // Read the file contents at the resolved file path into a byte array. // May throw PermissionSetFileReadException, which is handled in Compilation.Emit. var resolver = context.Module.CommonCompilation.Options.XmlReferenceResolver; // If the resolver isn't available we won't get here since we had to use it to resolve the path. RoslynDebug.Assert(resolver != null); try { using (Stream stream = resolver.OpenReadChecked(_resolvedPermissionSetFilePath)) { // Convert the byte array contents into a string in hexadecimal format. hexFileContent = ConvertToHex(stream); } } catch (IOException e) { throw new PermissionSetFileReadException(e.Message, _resolvedPermissionSetFilePath); } // Synthesize a named attribute argument "Hex = hexFileContent". return(ImmutableArray.Create <Cci.IMetadataNamedArgument>(new HexPropertyMetadataNamedArgument(stringType, new MetadataConstant(stringType, hexFileContent)))); }
public override LocalDefinition GetPreviousLocal( Cci.ITypeReference type, ILocalSymbol symbol, string nameOpt, CommonSynthesizedLocalKind synthesizedKind, uint pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags) { var syntaxRefs = symbol.DeclaringSyntaxReferences; Debug.Assert(!syntaxRefs.IsDefault); if (!syntaxRefs.IsDefaultOrEmpty) { var currentSyntax = syntaxRefs[0].GetSyntax(); var previousSyntax = syntaxMap(currentSyntax); if (previousSyntax != null) { int offset; if (previousDeclaratorToOffset.TryGetValue(previousSyntax, out offset)) { var previousType = symbolMap.MapReference(type); if (previousType != null) { var localKey = new EncLocalInfo(offset, previousType, constraints, synthesizedKind, signature: null); int slot; // Should report a warning if the type of the local has changed // and the previous value will be dropped. (Bug #781309.) if (previousLocalInfoToSlot.TryGetValue(localKey, out slot)) { return(new LocalDefinition( symbol, nameOpt, type, slot, synthesizedKind, pdbAttributes, constraints, isDynamic, dynamicTransformFlags)); } } } } } return(null); }
public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, DiagnosticBag diagnostics, out int slotIndex) { // Well-formed state machine attribute wasn't found in the baseline (the type is missing or bad). // Should rarely happen since the IDE reports a rude edit if the attribute type doesn't exist. if (_awaiterMapOpt == null) { // TODO: better error message https://github.com/dotnet/roslyn/issues/9196 diagnostics.Add(_messageProvider.CreateDiagnostic(_messageProvider.ERR_ModuleEmitFailure, NoLocation.Singleton, _previousTopLevelMethod.ContainingModule.Name)); slotIndex = -1; return(false); } return(_awaiterMapOpt.TryGetValue(_symbolMap.MapReference(currentType), out slotIndex)); }
internal Cci.IFieldReference CreateDataField(ImmutableArray <byte> data) { Debug.Assert(!IsFrozen); Cci.ITypeReference type = this.proxyTypes.GetOrAdd((uint)data.Length, size => GetStorageStruct(size)); //This object may be accessed concurrently //it is not expected to have a lot of contention here so we will just use lock //if it becomes an issue we can switch to lock-free data structures. lock (this.mappedFields) { var name = GenerateDataFieldName(this.mappedFields.Count); var newField = new MappedField(name, this, type, data); this.mappedFields.Add(newField); return(newField); } }
private LocalDefinition DeclareLocalImpl( Cci.ITypeReference type, ILocalSymbolInternal symbolOpt, string nameOpt, SynthesizedLocalKind kind, LocalDebugId id, uint pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags) { if (_lazyAllLocals == null) { _lazyAllLocals = new ArrayBuilder <Cci.ILocalDefinition>(1); } LocalDefinition local; if (symbolOpt != null && _slotAllocatorOpt != null) { local = _slotAllocatorOpt.GetPreviousLocal(type, symbolOpt, nameOpt, kind, id, pdbAttributes, constraints, isDynamic, dynamicTransformFlags); if (local != null) { int slot = local.SlotIndex; _lazyAllLocals[slot] = local; return(local); } } local = new LocalDefinition( symbolOpt: symbolOpt, nameOpt: nameOpt, type: type, slot: _lazyAllLocals.Count, synthesizedKind: kind, id: id, pdbAttributes: pdbAttributes, constraints: constraints, isDynamic: isDynamic, dynamicTransformFlags: dynamicTransformFlags); _lazyAllLocals.Add(local); return(local); }
/// <summary> /// Creates a new LocalDefinition. /// </summary> /// <param name="identity">Local symbol, used by edit and continue only, null otherwise.</param> /// <param name="name">Name associated with the slot.</param> /// <param name="type">Type associated with the slot.</param> /// <param name="slot">Slot position in the signature.</param> /// <param name="dynamicTransformFlags">Contains the synthesized dynamic attributes of the local</param> /// <param name="isCompilerGenerated">True if the local was not declared in source.</param> /// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param> /// <param name="isDynamic">Specifies if the type is Dynamic.</param> public LocalDefinition( object identity, string name, Cci.ITypeReference type, int slot, bool isCompilerGenerated, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray<TypedConstant> dynamicTransformFlags) { this.identity = identity; this.name = name; this.type = type; this.slot = slot; this.isCompilerGenerated = isCompilerGenerated; this.dynamicTransformFlags = dynamicTransformFlags; this.constraints = constraints; this.isDynamic = isDynamic; }
/// <summary> /// Creates a new LocalDefinition. /// </summary> /// <param name="identity">Local symbol, used by edit and continue only, null otherwise.</param> /// <param name="name">Name associated with the slot.</param> /// <param name="type">Type associated with the slot.</param> /// <param name="slot">Slot position in the signature.</param> /// <param name="dynamicTransformFlags">Contains the synthesized dynamic attributes of the local</param> /// <param name="isCompilerGenerated">True if the local was not declared in source.</param> /// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param> /// <param name="isDynamic">Specifies if the type is Dynamic.</param> public LocalDefinition( object identity, string name, Cci.ITypeReference type, int slot, bool isCompilerGenerated, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags) { this.identity = identity; this.name = name; this.type = type; this.slot = slot; this.isCompilerGenerated = isCompilerGenerated; this.dynamicTransformFlags = dynamicTransformFlags; this.constraints = constraints; this.isDynamic = isDynamic; }
internal Cci.IFieldReference GetOrAddInstrumentationPayloadRoot( int analysisKind, Cci.ITypeReference payloadRootType ) { InstrumentationPayloadRootField?payloadRootField; if (!_instrumentationPayloadRootFields.TryGetValue(analysisKind, out payloadRootField)) { Debug.Assert(!IsFrozen); payloadRootField = _instrumentationPayloadRootFields.GetOrAdd( analysisKind, kind => new InstrumentationPayloadRootField(this, kind, payloadRootType) ); } Debug.Assert(payloadRootField.Type == payloadRootType); return(payloadRootField); }
/// <summary> /// Creates a new LocalDefinition. /// </summary> /// <param name="symbolOpt">Local symbol, used by edit and continue only, null otherwise.</param> /// <param name="nameOpt">Name associated with the slot.</param> /// <param name="type">Type associated with the slot.</param> /// <param name="slot">Slot position in the signature.</param> /// <param name="synthesizedKind">Local kind.</param> /// <param name="id">Local id.</param> /// <param name="pdbAttributes">Value to emit in the attributes field in the PDB.</param> /// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param> /// <param name="dynamicTransformFlags">The synthesized dynamic attributes of the local.</param> /// <param name="tupleElementNames">Tuple element names of the local.</param> public LocalDefinition( ILocalSymbol symbolOpt, string nameOpt, Cci.ITypeReference type, int slot, SynthesizedLocalKind synthesizedKind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <string> tupleElementNames) { _symbolOpt = symbolOpt; _nameOpt = nameOpt; _type = type; _slot = slot; _slotInfo = new LocalSlotDebugInfo(synthesizedKind, id); _pdbAttributes = pdbAttributes; _tupleElementNames = tupleElementNames.NullToEmpty(); _constraints = constraints; }
internal LocalDefinition DeclareLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string name, SynthesizedLocalKind kind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <TypedConstant> dynamicTransformFlags, ImmutableArray <TypedConstant> tupleElementNames, bool isSlotReusable) { if (!isSlotReusable || !FreeSlots.TryPop(new LocalSignature(type, constraints), out LocalDefinition local)) { local = this.DeclareLocalImpl(type, symbol, name, kind, id, pdbAttributes, constraints, dynamicTransformFlags, tupleElementNames); } LocalMap.Add(symbol, local); return(local); }
internal LocalDefinition DeclareLocal( Cci.ITypeReference type, ILocalSymbol symbol, string name, CommonSynthesizedLocalKind synthesizedKind, uint pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags) { LocalDefinition local; if ((name != null) || !FreeSlots.TryPop(new LocalSignature(type, constraints), out local)) { local = this.DeclareLocalImpl(type, symbol, name, synthesizedKind, pdbAttributes, constraints, isDynamic, dynamicTransformFlags); } LocalMap.Add(symbol, local); return(local); }
public override LocalDefinition GetPreviousLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string nameOpt, SynthesizedLocalKind synthesizedKind, LocalDebugId id, uint pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags) { var local = symbol as EELocalSymbol; if ((object)local == null) { return(null); } return(_locals[local.Ordinal]); }
/// <summary> /// Creates a new LocalDefinition. /// </summary> /// <param name="symbolOpt">Local symbol, used by edit and continue only, null otherwise.</param> /// <param name="nameOpt">Name associated with the slot.</param> /// <param name="type">Type associated with the slot.</param> /// <param name="slot">Slot position in the signature.</param> /// <param name="dynamicTransformFlags">Contains the synthesized dynamic attributes of the local</param> /// <param name="synthesizedKind">Local kind.</param> /// <param name="id">Local id.</param> /// <param name="pdbAttributes">Value to emit in the attributes field in the PDB.</param> /// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param> /// <param name="isDynamic">Specifies if the type is Dynamic.</param> public LocalDefinition( ILocalSymbol symbolOpt, string nameOpt, Cci.ITypeReference type, int slot, SynthesizedLocalKind synthesizedKind, LocalDebugId id, uint pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray<TypedConstant> dynamicTransformFlags) { _symbolOpt = symbolOpt; _nameOpt = nameOpt; _type = type; _slot = slot; _slotInfo = new LocalSlotDebugInfo(synthesizedKind, id); _pdbAttributes = pdbAttributes; _dynamicTransformFlags = dynamicTransformFlags; _constraints = constraints; _isDynamic = isDynamic; }
/// <summary> /// Creates a new LocalDefinition. /// </summary> /// <param name="symbolOpt">Local symbol, used by edit and continue only, null otherwise.</param> /// <param name="nameOpt">Name associated with the slot.</param> /// <param name="type">Type associated with the slot.</param> /// <param name="slot">Slot position in the signature.</param> /// <param name="synthesizedKind">Local kind.</param> /// <param name="id">Local id.</param> /// <param name="pdbAttributes">Value to emit in the attributes field in the PDB.</param> /// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param> /// <param name="dynamicTransformFlags">The synthesized dynamic attributes of the local.</param> /// <param name="tupleElementNames">Tuple element names of the local.</param> public LocalDefinition( ILocalSymbol symbolOpt, string nameOpt, Cci.ITypeReference type, int slot, SynthesizedLocalKind synthesizedKind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray<TypedConstant> dynamicTransformFlags, ImmutableArray<TypedConstant> tupleElementNames) { _symbolOpt = symbolOpt; _nameOpt = nameOpt; _type = type; _slot = slot; _slotInfo = new LocalSlotDebugInfo(synthesizedKind, id); _pdbAttributes = pdbAttributes; _dynamicTransformFlags = dynamicTransformFlags.NullToEmpty(); _tupleElementNames = tupleElementNames.NullToEmpty(); _constraints = constraints; }
internal MappedField(string name, Cci.INamedTypeDefinition containingType, Cci.ITypeReference type, ImmutableArray<byte> block) { Debug.Assert(name != null); Debug.Assert(containingType != null); Debug.Assert(type != null); Debug.Assert(!block.IsDefault); this.containingType = containingType; this.type = type; this.block = block; this.name = name; }
internal MappedField(string name, Cci.INamedTypeDefinition containingType, Cci.ITypeReference type, Cci.ISectionBlock block) { this.containingType = containingType; this.type = type; this.block = block; this.name = name; }
internal ExplicitSizeStruct(uint size, PrivateImplementationDetails containingType, Cci.ITypeReference sysValueType) { this.size = size; this.containingType = containingType; this.sysValueType = sysValueType; }
public ArgListParameterTypeInformation(int ordinal, bool isByRef, Cci.ITypeReference type) { this.ordinal = (ushort)ordinal; this.isByRef = isByRef; this.type = type; }
public HexPropertyMetadataNamedArgument(Cci.ITypeReference type, Cci.IMetadataExpression value) { this.type = type; this.value = value; }