Skip to content

Commit a21df67

Browse files
committed
Fix for Broader Parent Accessor
1 parent 4bd1011 commit a21df67

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

MonacoEditorComponent/Helpers/ParentAccessor.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Monaco.Helpers
1212
public sealed class ParentAccessor
1313
{
1414
private object parent;
15-
private TypeInfo typeinfo;
15+
private Type typeinfo;
1616
private Dictionary<string, Action> actions;
1717

1818
/// <summary>
@@ -22,7 +22,7 @@ public sealed class ParentAccessor
2222
public ParentAccessor(object parent)
2323
{
2424
this.parent = parent;
25-
this.typeinfo = parent.GetType().GetTypeInfo();
25+
this.typeinfo = parent.GetType();
2626
this.actions = new Dictionary<string, Action>();
2727
}
2828

@@ -59,7 +59,7 @@ public bool CallAction(string name)
5959
/// <returns>Property Value or null.</returns>
6060
public object GetValue(string name)
6161
{
62-
var propinfo = typeinfo.GetDeclaredProperty(name);
62+
var propinfo = typeinfo.GetProperty(name);
6363
return propinfo?.GetValue(this.parent);
6464
}
6565

@@ -73,11 +73,12 @@ public object GetValue(string name)
7373
/// <returns>Value of Child Property or null.</returns>
7474
public object GetChildValue(string name, string child)
7575
{
76-
var propinfo = typeinfo.GetDeclaredProperty(name);
76+
// TODO: Support params for multi-level digging?
77+
var propinfo = typeinfo.GetProperty(name);
7778
var prop = propinfo?.GetValue(this.parent);
7879
if (prop != null)
7980
{
80-
var childinfo = prop.GetType().GetTypeInfo().GetDeclaredProperty(child);
81+
var childinfo = prop.GetType().GetProperty(child);
8182
return childinfo?.GetValue(prop);
8283
}
8384

@@ -91,7 +92,7 @@ public object GetChildValue(string name, string child)
9192
/// <param name="value">Value to set.</param>
9293
public void SetValue(string name, object value)
9394
{
94-
var propinfo = typeinfo.GetDeclaredProperty(name); // TODO: Cache these?
95+
var propinfo = typeinfo.GetProperty(name); // TODO: Cache these?
9596
propinfo?.SetValue(this.parent, value);
9697
}
9798
}

0 commit comments

Comments
 (0)