Coder Social home page Coder Social logo

expressions's People

Contributors

pvginkel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

expressions's Issues

Add support for generic methods

Add support for generic methods. The idea is that e.g. the following method would be supported:

T First<T>(IEnumerable<T> collection) { }

Support for this helps e.g. with working with collections that don't implement IList and adds support for functionality similar to extension methods.

NullReferenceException invoking expression

I'm stuck with an issue with a test expression that I'm writing:

string translatedString = "uppercase("hello")";
var expr = new DynamicExpression(translatedString, ExpressionLanguage.Csharp);
var context = new ExpressionContext(null, new CustomOwner(), true);
var boundExpression = expr.Bind(context);
object res = boundExpression.Invoke();

At Invoke time, I get a NullRef exception without any useful debug info.
My CustomOwner is as simple as this:

public class CustomOwner
{
public string uppercase(string str)
{
return str.ToUpperInvariant();
}
}

can you please tell me what I am doing wrong?

thanks

GetVariableType/GetVariableValue function question

Hi,

Suppose I have expression like this A.B.Value.
Result of Value property depended to B type and some logic.
Is there a way to get the B object from GetVariableType/GetVariableValue functions.
Singature of these functions has variable name only.

Thanks

Add support for constant folding

Add support for constant folding. When an expression is completely constant, it shouldn't be compiled at all but the constant result should be returned instead.

Clean up thrown exceptions

Thrown exceptions must be cleaned up. The InvalidExpressions unit test does not get checked for the type of exception thrown yet. Also, exceptions probably could get a context (position/line number) from ANTLR.

Multiline Expressions

Is there any way to have multiline expressions evaluated? I'd like the user to be able to declare a few simple variables inline so their final formula isn't so complicated. Those variables could be dependent on previous variables...

a = 1.5;
b = 5.6;
c = a * b / 1000;
a + b * c / a + b;

Overload resolution ambiguous for implicit cast

There is a failing unit test which pertains to overload resolution. The following case fails to find the correct overload:

void Method(float a) { }
void Method(double a) { }

Method(1)

The problem here is that integer can be implicitly casted to both float and double, and the overload resolution mechanism currently doesn't score overloads which are matched through implicit casts. C# b.t.w. calls the method with the float argument.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.