These are 3 changes in smoke in preparation of polymer's codegen. I happened to make them at once, but let me know if you prefer that I split them up a bit:

(a) add filter to query. This makes it easier to support *Changed  without having to generate metadata about lots of useless methods. We might remove *Changed in the future, but I still think this is a nice feature for smoke.

(b) changed recorder.dart to automatically include getters/setters for queries. It is the most common use case that you query a member because you want both the metadata and to read/write/invoke it.

(c) add a new smoke implementation to make it easier to debug inconsistencies between static vs mirrors implementations. (I used this while debugging stuffin polymer)

R=jmesserly@google.com

Review URL: https://codereview.chromium.org//204143002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/smoke@34117 260f80e4-7a28-3924-810f-c04153c831b5
10 files changed
tree: 7b3ecdebebc55d504561dd21bf1b1b76369e95bc
  1. AUTHORS
  2. CHANGELOG.md
  3. LICENSE
  4. PATENTS
  5. README.md
  6. lib/
  7. pubspec.yaml
  8. test/
README.md

Smoke (and mirrors)

Smoke is a package that exposes a reduced reflective system API. This API includes accessing objects in a dynamic fashion (read properties, write properties, and call methods), inspecting types (for example, whether a method exists), and symbol/string convertion.

The package provides a default implementation of this API that uses the system's mirrors, but additionally provides mechanisms for statically generating code that can replace the mirror-based implementation.

The intention of this package is to allow frameworks to use mirrors in a way that will not impose on their users. The idea is that users will not worry about how to preserve symbols when compiling with dart2js (for instance, using the MirrorsUsed annotation). Instead, this package provides the building blocks to autogenerate whatever is needed for dart2js to be happy and to generate reasonable code.

Note this package alone doesn't know how to generate everything, but it provides a simple API that different frameworks can use to define what needs to be generated.

Smoke reflective API

Use package:smoke/smoke.dart in your framework to read and write objects and to inspect type information. Read the Dart-docs for more details.

Code Generation

TBD. We envision we'll have a base transformer class that can be tailored to create a transformer for your framework.