Added support of accessing index of dynamic object#142
Conversation
davideicardi
left a comment
There was a problem hiding this comment.
Thank you very much!
Just added some minor comments.
| Assert.Throws<RuntimeBinderException>(() => interpreter.Eval("dyn.BAR", new Parameter("dyn", dyn))); | ||
| } | ||
|
|
||
| [Test] |
There was a problem hiding this comment.
There are some minor code alignment problems here and in other files? Probably due to tab/space mismatch ...
There was a problem hiding this comment.
ok, i will format codes again.
| var interpreter = new Interpreter().SetVariable("dyn", (object)dyn); | ||
| Assert.AreEqual(dyn.Sub[0], interpreter.Eval("dyn.Sub[0]")); | ||
| } | ||
|
|
There was a problem hiding this comment.
Maybe it makes sense to try some invalid cases?
Here some suggestions that I would expect should generate a parse exception:
- try to use index for a property that is not an array
- try to use as an index an invalid type (like passing a string?)
- try to pass some invalid syntax like
dyn.Sub[0,dyn.Sub 0]ordyn.Sub[[0]] - try to get an out of bound element (this just to check that exception are handled correctly ... )
What do you think?
There was a problem hiding this comment.
I will add more cases like what you said. Thanks !
|
It would be very nice that you could also add a note in the README regarding this new dynamic feature (currently there isn't a specific section for dynamic, it is only mentioned in |
I would add some notes to |
|
Done! Thanks! |
|
Thank you! Merged! |
|
Release v2.5.0 with these changes. |
Fixes #127, #92
Thanks !