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

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

Issue 24197003: Support typeVariables in ClassMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 /// Enables debugging of fast/slow objects using V8-specific primitives. 7 /// Enables debugging of fast/slow objects using V8-specific primitives.
8 const DEBUG_FAST_OBJECTS = false; 8 const DEBUG_FAST_OBJECTS = false;
9 9
10 /** 10 /**
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 2081
2082 void emitClassBuilderWithReflectionData(String className, 2082 void emitClassBuilderWithReflectionData(String className,
2083 ClassElement classElement, 2083 ClassElement classElement,
2084 ClassBuilder builder, 2084 ClassBuilder builder,
2085 CodeBuffer buffer) { 2085 CodeBuffer buffer) {
2086 var metadata = buildMetadataFunction(classElement); 2086 var metadata = buildMetadataFunction(classElement);
2087 if (metadata != null) { 2087 if (metadata != null) {
2088 builder.addProperty("@", metadata); 2088 builder.addProperty("@", metadata);
2089 } 2089 }
2090 2090
2091 if (backend.isNeededForReflection(classElement)) {
2092 Link typeVars = classElement.typeVariables;
2093 List properties = [];
2094 for (TypeVariableType typeVar in typeVars) {
2095 properties.add(js.string(typeVar.name.slowToString()));
2096 properties.add(js.toExpression(reifyType(typeVar.element.bound)));
2097 }
2098
2099 ClassElement superclass = classElement.superclass;
2100 bool hasSuper = superclass != null;
2101 if ((!properties.isEmpty && !hasSuper) ||
2102 (hasSuper && superclass.typeVariables != typeVars)) {
2103 builder.addProperty('<>', new jsAst.ArrayInitializer.from(properties));
2104 }
2105 }
2091 List<CodeBuffer> classBuffers = elementBuffers[classElement]; 2106 List<CodeBuffer> classBuffers = elementBuffers[classElement];
2092 if (classBuffers == null) { 2107 if (classBuffers == null) {
2093 classBuffers = []; 2108 classBuffers = [];
2094 } else { 2109 } else {
2095 elementBuffers.remove(classElement); 2110 elementBuffers.remove(classElement);
2096 } 2111 }
2097 CodeBuffer statics = new CodeBuffer(); 2112 CodeBuffer statics = new CodeBuffer();
2098 statics.write('{$n'); 2113 statics.write('{$n');
2099 bool hasStatics = false; 2114 bool hasStatics = false;
2100 ClassBuilder staticsBuilder = new ClassBuilder(); 2115 ClassBuilder staticsBuilder = new ClassBuilder();
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after
4437 4452
4438 const String HOOKS_API_USAGE = """ 4453 const String HOOKS_API_USAGE = """
4439 // The code supports the following hooks: 4454 // The code supports the following hooks:
4440 // dartPrint(message) - if this function is defined it is called 4455 // dartPrint(message) - if this function is defined it is called
4441 // instead of the Dart [print] method. 4456 // instead of the Dart [print] method.
4442 // dartMainRunner(main) - if this function is defined, the Dart [main] 4457 // dartMainRunner(main) - if this function is defined, the Dart [main]
4443 // method will not be invoked directly. 4458 // method will not be invoked directly.
4444 // Instead, a closure that will invoke [main] is 4459 // Instead, a closure that will invoke [main] is
4445 // passed to [dartMainRunner]. 4460 // passed to [dartMainRunner].
4446 """; 4461 """;
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698