public abstract LocalDefinition GetPreviousLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string nameOpt, SynthesizedLocalKind kind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray<TypedConstant> dynamicTransformFlags);
public override LocalDefinition GetPreviousLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string nameOpt, SynthesizedLocalKind synthesizedKind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <bool> dynamicTransformFlags, ImmutableArray <string> tupleElementNames) { var local = symbol as EELocalSymbol; if ((object)local == null) { return(null); } return(_locals[local.Ordinal]); }
internal LocalDefinition DeclareLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string name, SynthesizedLocalKind kind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <string> tupleElementNames, bool isSlotReusable) { LocalDefinition local; if (!isSlotReusable || !FreeSlots.TryPop(new LocalSignature(type, constraints), out local)) { local = this.DeclareLocalImpl(type, symbol, name, kind, id, pdbAttributes, constraints, tupleElementNames); } LocalMap.Add(symbol, local); return(local); }
public LocalDefinition( ILocalSymbol?symbolOpt, string?nameOpt, Cci.ITypeReference type, int slot, SynthesizedLocalKind synthesizedKind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <bool> dynamicTransformFlags, ImmutableArray <string> tupleElementNames) { _symbolOpt = symbolOpt; _nameOpt = nameOpt; _type = type; _slot = slot; _slotInfo = new LocalSlotDebugInfo(synthesizedKind, id); _pdbAttributes = pdbAttributes; _dynamicTransformFlags = dynamicTransformFlags.NullToEmpty(); _tupleElementNames = tupleElementNames.NullToEmpty(); _constraints = constraints; }
/// <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, LocalVariableAttributes 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="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, LocalVariableAttributes 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; }
public LocalVariableHandle AddLocalVariable(LocalVariableAttributes attributes, int index, StringHandle name) { _localVariableTable.Add(new LocalVariableRow { Attributes = (ushort)attributes, Index = (ushort)index, Name = name }); return MetadataTokens.LocalVariableHandle(_localVariableTable.Count); }
public SymbolVariable(string name, LocalVariableAttributes attributes, int index) { _name = name; _attributes = attributes; _index = index; }
private void DefineLocalVariable(uint index, string name, LocalVariableAttributes attributes, StandaloneSignatureHandle localSignatureHandleOpt) { uint localSignatureToken = localSignatureHandleOpt.IsNil ? 0 : (uint)MetadataTokens.GetToken(localSignatureHandleOpt); const uint ADDR_IL_OFFSET = 1; try { _symWriter.DefineLocalVariable2(name, (uint)attributes, localSignatureToken, ADDR_IL_OFFSET, index, 0, 0, 0, 0); if (_callLogger.LogOperation(OP.DefineLocalVariable2)) { _callLogger.LogArgument(name); _callLogger.LogArgument((uint)attributes); _callLogger.LogArgument(localSignatureToken); _callLogger.LogArgument(ADDR_IL_OFFSET); _callLogger.LogArgument(index); _callLogger.LogArgument((uint)0); _callLogger.LogArgument((uint)0); _callLogger.LogArgument((uint)0); _callLogger.LogArgument((uint)0); } } catch (Exception ex) { throw new PdbWritingException(ex); } }
public static void ValidateVariable(ISymUnmanagedVariable variable, string name, int slot, LocalVariableAttributes attributes, byte[] signature) { int length, length2; // name: Assert.Equal(HResult.S_OK, variable.GetName(0, out length, null)); Assert.Equal(name.Length + 1, length); var actualName = new char[length]; Assert.Equal(HResult.S_OK, variable.GetName(length, out length2, actualName)); Assert.Equal(length, length2); Assert.Equal(name + "\0", new string(actualName)); int value; Assert.Equal(HResult.S_OK, variable.GetAddressField1(out value)); Assert.Equal(slot, value); Assert.Equal(HResult.E_NOTIMPL, variable.GetAddressField2(out value)); Assert.Equal(HResult.E_NOTIMPL, variable.GetAddressField3(out value)); Assert.Equal(HResult.E_NOTIMPL, variable.GetStartOffset(out value)); Assert.Equal(HResult.E_NOTIMPL, variable.GetEndOffset(out value)); Assert.Equal(HResult.S_OK, variable.GetAttributes(out value)); Assert.Equal(attributes, (LocalVariableAttributes)value); Assert.Equal(HResult.S_OK, variable.GetAddressKind(out value)); Assert.Equal(1, value); Assert.Equal(HResult.S_OK, variable.GetSignature(0, out length, null)); var actualSignature = new byte[length]; Assert.Equal(HResult.S_OK, variable.GetSignature(length, out length2, actualSignature)); Assert.Equal(length, length2); AssertEx.Equal(signature, actualSignature); }
public override LocalDefinition GetPreviousLocal( Cci.ITypeReference currentType, ILocalSymbolInternal currentLocalSymbol, string nameOpt, SynthesizedLocalKind kind, LocalDebugId id, LocalVariableAttributes 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); }
public override LocalDefinition?GetPreviousLocal( Cci.ITypeReference currentType, ILocalSymbolInternal currentLocalSymbol, string?name, SynthesizedLocalKind kind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray <bool> dynamicTransformFlags, ImmutableArray <string> tupleElementNames ) { if (id.IsNone) { return(null); } if ( !TryGetPreviousLocalId( currentLocalSymbol.GetDeclaratorSyntax(), id, out LocalDebugId 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 ); if (!_previousLocalSlots.TryGetValue(localKey, out int slot)) { return(null); } return(new LocalDefinition( currentLocalSymbol, name, currentType, slot, kind, id, pdbAttributes, constraints, dynamicTransformFlags, tupleElementNames )); }
public override LocalDefinition GetPreviousLocal( Cci.ITypeReference type, ILocalSymbolInternal symbol, string nameOpt, SynthesizedLocalKind synthesizedKind, LocalDebugId id, LocalVariableAttributes pdbAttributes, LocalSlotConstraints constraints, ImmutableArray<TypedConstant> dynamicTransformFlags, ImmutableArray<TypedConstant> tupleElementNames) { var local = symbol as EELocalSymbol; if ((object)local == null) { return null; } return _locals[local.Ordinal]; }
public abstract void DefineLocalVariable(int index, string name, LocalVariableAttributes attributes, int localSignatureToken);