Browse Source

Hack for variables that change type (Forum-7347)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1384 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
765a5aa0b3
  1. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ClassVariable.cs
  2. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs
  3. 11
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ClassVariable.cs

@ -11,8 +11,8 @@ namespace Debugger
{ {
public class ClassVariable: Variable public class ClassVariable: Variable
{ {
bool isStatic; internal bool isStatic;
bool isPublic; internal bool isPublic;
public bool IsStatic { public bool IsStatic {
get { get {

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

@ -23,8 +23,8 @@ namespace Debugger
string name; string name;
VariableCollection subVariables; VariableCollection subVariables;
protected ValueGetter valueGetter; internal protected ValueGetter valueGetter;
Value cachedValue; internal Value cachedValue;
event EventHandler<DebuggerEventArgs> valueChanged; event EventHandler<DebuggerEventArgs> valueChanged;
public event EventHandler<VariableCollectionEventArgs> ValueRemovedFromCollection; public event EventHandler<VariableCollectionEventArgs> ValueRemovedFromCollection;
@ -89,7 +89,7 @@ namespace Debugger
} }
} }
protected virtual void OnValueChanged() protected internal virtual void OnValueChanged()
{ {
cachedValue = null; cachedValue = null;
if (valueChanged != null) { if (valueChanged != null) {

11
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

@ -144,6 +144,17 @@ namespace Debugger
foreach(Variable newVariable in newVariables) { foreach(Variable newVariable in newVariables) {
if (this.Contains(newVariable.Name)) { if (this.Contains(newVariable.Name)) {
Variable oldVariable = this[newVariable.Name];
// HACK: Realy bad object-oriented design!!!
// Trasfer the new variable into the old one
if (oldVariable != newVariable) {
oldVariable.valueGetter = newVariable.valueGetter;
oldVariable.cachedValue = null;
if (newVariable is ClassVariable && oldVariable is ClassVariable) {
((ClassVariable)oldVariable).isPublic = ((ClassVariable)oldVariable).isPublic;
((ClassVariable)oldVariable).isStatic = ((ClassVariable)oldVariable).isStatic;
}
}
// Keep the variable in the list // Keep the variable in the list
toBeRemoved.Remove(this[newVariable.Name]); toBeRemoved.Remove(this[newVariable.Name]);
} else { } else {

Loading…
Cancel
Save