Skip to content

Commit ebfe3a7

Browse files
committed
small changes according to PR
1 parent 8f6958f commit ebfe3a7

1 file changed

Lines changed: 6 additions & 29 deletions

File tree

src/DynamicObj/DynamicObj.fs

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ type DynamicObj() =
7272
member this.SetValue (name,value) = // private
7373
// first check to see if there's a native property to set
7474

75-
match ReflectionUtils.tryGetStaticPropertyInfo this name with
75+
match this.TryGetStaticPropertyInfo name with
7676
| Some pi ->
7777
if pi.IsMutable then
7878
pi.SetValue this value
@@ -133,36 +133,13 @@ type DynamicObj() =
133133
/// Returns both instance and dynamic properties when passed true, only dynamic properties otherwise.
134134
/// Properties are returned as a key value pair of the member names and the boxed values
135135
member this.GetProperties includeInstanceProperties : seq<KeyValuePair<string,obj>> =
136-
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
137-
FableJS.getPropertyHelpers this
138-
|> Seq.choose (fun pd ->
139-
if includeInstanceProperties || pd.IsDynamic then
140-
new KeyValuePair<string, obj>(pd.Name, pd.GetValue this)
141-
|> Some
136+
this.GetPropertyHelpers(includeInstanceProperties)
137+
|> Seq.choose (fun kv ->
138+
if kv.Name <> "properties" then
139+
Some (KeyValuePair(kv.Name, kv.GetValue this))
142140
else
143-
None
141+
None
144142
)
145-
#endif
146-
#if FABLE_COMPILER_PYTHON
147-
FablePy.getPropertyHelpers this
148-
|> Seq.choose (fun pd ->
149-
if includeInstanceProperties || pd.IsDynamic then
150-
new KeyValuePair<string, obj>(pd.Name, pd.GetValue this)
151-
|> Some
152-
else
153-
None
154-
)
155-
#endif
156-
#if !FABLE_COMPILER
157-
seq [
158-
if includeInstanceProperties then
159-
for prop in ReflectionUtils.getStaticProperties (this) ->
160-
new KeyValuePair<string, obj>(prop.Name, prop.GetValue(this))
161-
for key in properties.Keys ->
162-
new KeyValuePair<string, obj>(key, properties.[key]);
163-
]
164-
#endif
165-
|> Seq.filter (fun kv -> kv.Key.ToLower() <> "properties")
166143

167144
/// Copies all dynamic members of the DynamicObj to the target DynamicObj.
168145
member this.CopyDynamicPropertiesTo(target:#DynamicObj, ?overWrite) =

0 commit comments

Comments
 (0)