Coder Social home page Coder Social logo

Comments (4)

eernstg avatar eernstg commented on July 19, 2024

Just considering a possible work-around: Is there an easy way to tell how many levels of lifting any particular piece of code will tolerate without getting a different semantics? (by 'lifting' I mean: moving a piece of code from inside to outside a given scope, similar to lambda lifting and similar to loop invariant expression hoisting). For code in a constructor or method argument list default expression, we'd just need to know that we can lift the expression one level (to global), and then we'd control the target context well enough (we're generating it) to make sure the expression doesn't get a different semantics when inserted there. This means that we would be able to use the naive approach for moving the code as long as it works, and then we could bail out with an error message in the cases where something more elaborate is needed (or we could run some other algorithms and cover more and more cases as we proceed, leaving fewer and fewer cases unimplemented).

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

Closing this issue: Implemented support for a number of special cases (including default value expressions which have no local dependencies such as literals, and expressions which are simple identifiers looked up in the same class or top-level of the same library); missing cases (e.g., using const somePrefix.C() as a default value or using @somePrefix.C() as metadata) will give rise to an error during transformation. We'll need extra tests for the missing cases as well, but this will enable a lot of simple usages of default values and annotations to work, and the remaining cases can be considered as bugs that we will fix along the way.

from reflectable.dart.

sigurdm avatar sigurdm commented on July 19, 2024

Reopening, as we do not support all constants yet.

from reflectable.dart.

sigurdm avatar sigurdm commented on July 19, 2024

I am convinced now that except for private constants (and that's a different issue) we can reconstruct all constants.

from reflectable.dart.

Related Issues (20)

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.