Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2510)

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 19599007: Implement reflection on native classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Mark test as failing on VM (requires browser) Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 3a9154ac59c61f8276e432a2605ef036d861862c..310a717e5f3cd947851e423c08791110e8547df3 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -1833,16 +1833,25 @@ class CodeEmitterTask extends CompilerTask {
emitSuper(superName, builder);
emitRuntimeName(runtimeName, builder);
emitClassFields(classElement, builder, superName);
- var metadata = buildMetadataFunction(classElement);
- if (metadata != null) {
- builder.addProperty("@", metadata);
- }
emitClassGettersSetters(classElement, builder);
if (!classElement.isMixinApplication) {
emitInstanceMembers(classElement, builder);
}
emitIsTests(classElement, builder);
+ emitClassBuilderWithReflectionData(
+ className, classElement, builder, buffer);
+ }
+
+ void emitClassBuilderWithReflectionData(String className,
+ ClassElement classElement,
+ ClassBuilder builder,
+ CodeBuffer buffer) {
+ var metadata = buildMetadataFunction(classElement);
+ if (metadata != null) {
+ builder.addProperty("@", metadata);
+ }
+
List<CodeBuffer> classBuffers = elementBuffers[classElement];
if (classBuffers == null) {
classBuffers = [];
@@ -1853,8 +1862,7 @@ class CodeEmitterTask extends CompilerTask {
statics.write('{$n');
bool hasStatics = false;
ClassBuilder staticsBuilder = new ClassBuilder();
- if (emitClassFields(
- classElement, staticsBuilder, superName, emitStatics: true)) {
+ if (emitClassFields(classElement, staticsBuilder, '', emitStatics: true)) {
ngeoffray 2013/07/19 09:37:40 I don't understand this change.
ahe 2013/07/19 10:00:00 The superclass is irrelevant for the static field
hasStatics = true;
statics.write('"":$_');
statics.write(

Powered by Google App Engine
This is Rietveld 408576698