Skip to content

Instantly share code, notes, and snippets.

@jakemac53
Created July 28, 2015 17:52
Show Gist options
  • Save jakemac53/98a056538de10e1ac7f3 to your computer and use it in GitHub Desktop.
Save jakemac53/98a056538de10e1ac7f3 to your computer and use it in GitHub Desktop.
library index;
import 'package:reflectable/reflectable.dart';
class MyReflectable extends Reflectable {
const MyReflectable() : super(instanceInvokeCapability);
}
const myReflectable = const MyReflectable();
@myReflectable
class MyClass {
String get $ => 'hello';
}
main() {
var instance = new MyClass();
var mirror = myReflectable.reflect(instance);
print(mirror.invokeGetter(r'$'));
}
Building playground... (6.1s)
[Info from Dart2JS]:
Compiling playground|web/reflectable/index.dart...
[Error from Dart2JS on playground|web/reflectable/index.dart]:
web/reflectable/index_reflection_data.dart:14:223:
A '$' has special meaning inside a string, and must be followed by an identifier or an expression in curly braces ({}).
Try adding a backslash (\) to escape the '$'.
r.data = {const prefix0.MyReflectable(): new r.ReflectorData([new r.ClassMirrorImpl("MyClass", "index.MyClass", 0, const prefix0.MyReflectable(), [0], [1, 2, 3, 4, 5, 0], -1, {}, {}, {}, null)], [new r.MethodMirrorImpl("$", 3, 0, const prefix0.MyReflectable(), null), new r.MethodMirrorImpl("==", 2, null, const prefix0.MyReflectable(), null), new r.MethodMirrorImpl("toString", 2, null, const prefix0.MyReflectable(), null), new r.MethodMirrorImpl("noSuchMethod", 2, null, const prefix0.MyReflectable(), null), new r.MethodMirrorImpl("hashCode", 3, null, const prefix0.MyReflectable(), null), new r.MethodMirrorImpl("runtimeType", 3, null, const prefix0.MyReflectable(), null)], [prefix0.MyClass], {"==": (dynamic instance) => (x) => instance == x, "toString": (dynamic instance) => instance.toString, "noSuchMethod": (dynamic instance) => instance.noSuchMethod, "hashCode": (dynamic instance) => instance.hashCode, "runtimeType": (dynamic instance) => instance.runtimeType, "$": (dynamic instance) => instance.$}, {})};
name: repro
dependencies:
reflectable:
path: ../reflectable/reflectable
transformers:
- reflectable:
entry_points:
- web/index.dart
- $dart2js:
$include:
- web/index.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment