Browse Source

Fixed failing unit test in Python addin.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4545 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts 3.1-RC1
Matt Ward 16 years ago
parent
commit
00f98f795b
  1. 5
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs
  2. 14
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs

5
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs

@ -301,10 +301,7 @@ namespace ICSharpCode.PythonBinding
/// </summary> /// </summary>
object GetCurrentComponent() object GetCurrentComponent()
{ {
if (fieldExpression.VariableName.Length > 0) { return fieldExpression.GetObject(componentCreator);
return componentCreator.GetComponent(fieldExpression.VariableName);
}
return component;
} }
/// <summary> /// <summary>

14
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs

@ -177,6 +177,17 @@ namespace ICSharpCode.PythonBinding
return names.ToArray(); return names.ToArray();
} }
/// <summary>
/// Gets the object that the field expression variable refers to.
/// </summary>
public object GetObject(IComponentCreator componentCreator)
{
if (variableName.Length > 0) {
return componentCreator.GetComponent(variableName);
}
return componentCreator.RootComponent;
}
/// <summary> /// <summary>
/// Returns the object that the property is defined on. This method may just return the object /// Returns the object that the property is defined on. This method may just return the object
/// passed to it if the property is defined on that object. /// passed to it if the property is defined on that object.
@ -192,6 +203,9 @@ namespace ICSharpCode.PythonBinding
object currentComponent = component; object currentComponent = component;
for (int i = startIndex; i < members.Length - 1; ++i) { for (int i = startIndex; i < members.Length - 1; ++i) {
PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(currentComponent).Find(members[i], true); PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(currentComponent).Find(members[i], true);
if (propertyDescriptor == null) {
return null;
}
currentComponent = propertyDescriptor.GetValue(currentComponent); currentComponent = propertyDescriptor.GetValue(currentComponent);
} }
return currentComponent; return currentComponent;

Loading…
Cancel
Save