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

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: Address comments 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
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0104ffbcd1d36917c6f060d5e2c9481a0d52144b 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -1679,11 +1679,13 @@ class CodeEmitterTask extends CompilerTask {
String superName,
{ bool classIsNative: false,
bool emitStatics: false }) {
- assert(superName != null);
- String separator = '';
- String nativeName = namer.getPrimitiveInterceptorRuntimeName(classElement);
StringBuffer buffer = new StringBuffer();
- if (!emitStatics) {
+ if (emitStatics) {
+ assert(invariant(classElement, superName == null, message: superName));
+ } else {
+ assert(invariant(classElement, superName != null));
+ String nativeName =
+ namer.getPrimitiveInterceptorRuntimeName(classElement);
if (nativeName != null) {
buffer.write('$nativeName/');
}
@@ -1691,6 +1693,8 @@ class CodeEmitterTask extends CompilerTask {
}
int bufferClassLength = buffer.length;
+ String separator = '';
+
var fieldMetadata = [];
bool hasMetadata = false;
@@ -1833,16 +1837,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 = [];
@@ -1854,7 +1867,7 @@ class CodeEmitterTask extends CompilerTask {
bool hasStatics = false;
ClassBuilder staticsBuilder = new ClassBuilder();
if (emitClassFields(
- classElement, staticsBuilder, superName, emitStatics: true)) {
+ classElement, staticsBuilder, null, emitStatics: true)) {
hasStatics = true;
statics.write('"":$_');
statics.write(
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698