Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support of accessing index of dynamic object #142

Merged
merged 4 commits into from
May 21, 2021

Conversation

tingwei628
Copy link
Contributor

Fixes #127, #92
Thanks !

Copy link
Member

@davideicardi davideicardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

Just added some minor comments.

@@ -105,6 +106,15 @@ public void Case_Insensitive_Dynamic_Members()
Assert.Throws<RuntimeBinderException>(() => interpreter.Eval("dyn.BAR", new Parameter("dyn", dyn)));
}

[Test]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some minor code alignment problems here and in other files? Probably due to tab/space mismatch ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i will format codes again.

Copy link
Contributor Author

@tingwei628 tingwei628 May 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix 5e133f3

var interpreter = new Interpreter().SetVariable("dyn", (object)dyn);
Assert.AreEqual(dyn.Sub[0], interpreter.Eval("dyn.Sub[0]"));
}

Copy link
Member

@davideicardi davideicardi May 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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] or dyn.Sub[[0]]
  • try to get an out of bound element (this just to check that exception are handled correctly ... )

What do you think?

Copy link
Contributor Author

@tingwei628 tingwei628 May 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add more cases like what you said. Thanks !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix cfe6d99

@davideicardi
Copy link
Member

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 Features and Limitations. Maybe you can just review that phrases or add a specific section, as you prefer).

@tingwei628
Copy link
Contributor Author

tingwei628 commented May 20, 2021

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 Features and Limitations. Maybe you can just review that phrases or add a specific section, as you prefer).

I would add some notes to Limitations and Feature in README.

@tingwei628
Copy link
Contributor Author

Done! Thanks!

@davideicardi davideicardi merged commit 549cb83 into dynamicexpresso:master May 21, 2021
@davideicardi
Copy link
Member

Thank you! Merged!

@davideicardi
Copy link
Member

Release v2.5.0 with these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DynamicObject w/ index access throws ParseException
2 participants