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

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: Created 7 years, 3 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
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 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 2003
2004 void emitClassBuilderWithReflectionData(String className, 2004 void emitClassBuilderWithReflectionData(String className,
2005 ClassElement classElement, 2005 ClassElement classElement,
2006 ClassBuilder builder, 2006 ClassBuilder builder,
2007 CodeBuffer buffer) { 2007 CodeBuffer buffer) {
2008 var metadata = buildMetadataFunction(classElement); 2008 var metadata = buildMetadataFunction(classElement);
2009 if (metadata != null) { 2009 if (metadata != null) {
2010 builder.addProperty("@", metadata); 2010 builder.addProperty("@", metadata);
2011 } 2011 }
2012 2012
2013 if (backend.isNeededForReflection(classElement)) {
2014 List typeVars = [];
2015 for (TypeVariableType typeVar in classElement.typeVariables) {
2016 typeVars.add(js.string(typeVar.name.slowToString()));
2017 typeVars.add(js.toExpression(reifyType(typeVar.element.bound)));
2018 }
2019
2020 var superclass = classElement.superclass;
karlklose 2013/09/23 08:50:34 Please add a type annotation.
zarah 2013/09/23 11:17:02 Done.
2021 if ((!typeVars.isEmpty && superclass == null)
karlklose 2013/09/23 08:50:34 You could save the result of this check in a local
zarah 2013/09/23 11:17:02 Done.
2022 || (superclass != null
2023 && superclass.typeVariables != classElement.typeVariables)) {
karlklose 2013/09/23 08:50:34 Consider storing classElement.typeVariables in a l
zarah 2013/09/23 11:17:02 Done.
2024 builder.addProperty('<>', new jsAst.ArrayInitializer.from(typeVars));
karlklose 2013/09/23 08:50:34 We should move the '<>' into the namer (not this C
zarah 2013/09/23 11:17:02 OK.
2025 }
2026 }
2013 List<CodeBuffer> classBuffers = elementBuffers[classElement]; 2027 List<CodeBuffer> classBuffers = elementBuffers[classElement];
2014 if (classBuffers == null) { 2028 if (classBuffers == null) {
2015 classBuffers = []; 2029 classBuffers = [];
2016 } else { 2030 } else {
2017 elementBuffers.remove(classElement); 2031 elementBuffers.remove(classElement);
2018 } 2032 }
2019 CodeBuffer statics = new CodeBuffer(); 2033 CodeBuffer statics = new CodeBuffer();
2020 statics.write('{$n'); 2034 statics.write('{$n');
2021 bool hasStatics = false; 2035 bool hasStatics = false;
2022 ClassBuilder staticsBuilder = new ClassBuilder(); 2036 ClassBuilder staticsBuilder = new ClassBuilder();
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 4321
4308 const String HOOKS_API_USAGE = """ 4322 const String HOOKS_API_USAGE = """
4309 // The code supports the following hooks: 4323 // The code supports the following hooks:
4310 // dartPrint(message) - if this function is defined it is called 4324 // dartPrint(message) - if this function is defined it is called
4311 // instead of the Dart [print] method. 4325 // instead of the Dart [print] method.
4312 // dartMainRunner(main) - if this function is defined, the Dart [main] 4326 // dartMainRunner(main) - if this function is defined, the Dart [main]
4313 // method will not be invoked directly. 4327 // method will not be invoked directly.
4314 // Instead, a closure that will invoke [main] is 4328 // Instead, a closure that will invoke [main] is
4315 // passed to [dartMainRunner]. 4329 // passed to [dartMainRunner].
4316 """; 4330 """;
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | sdk/lib/_internal/lib/js_mirrors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698