ykmnkmi / jinja.dart

Jinja2 template engine port for Dart.
https://pub.dev/packages/jinja
MIT License
52 stars 11 forks source link

lazy evaluate on logic expression #17

Closed lindeer closed 2 years ago

lindeer commented 2 years ago

In case {% if page.next and page.next.path %}, currently jinja would throw NoSuchMethodError: The method '[]("path")' was called on null, actually it did not need to evaluate right expression of Binary.

maybe change calc directly is more simple, but that may break your static Object? calc() style, so I extends a _LogicBinary class so as to keep it.

ykmnkmi commented 2 years ago

You can change or inline static method. I also think to add two subclasses - Scalar and Logical.

lindeer commented 2 years ago

you mean I should drop this PR and change calc method instead of creating new class? and later you define Logical class?

ykmnkmi commented 2 years ago

Changing calc method.

lindeer commented 2 years ago

hey @ykmnkmi , how about this PR~

ykmnkmi commented 2 years ago

Thanks.