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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart

Issue 78873007: Support type argument substitution on unnamed mixin applications. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed to use the synthetic type variables added in the element model. Created 7 years 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class ClassEmitter extends CodeEmitterHelper { 7 class ClassEmitter extends CodeEmitterHelper {
8 /** 8 /**
9 * Documentation wanted -- johnniwinther 9 * Documentation wanted -- johnniwinther
10 * 10 *
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 if (!statics.isEmpty) { 330 if (!statics.isEmpty) {
331 classBuilder.addProperty('static', new jsAst.ObjectInitializer(statics)); 331 classBuilder.addProperty('static', new jsAst.ObjectInitializer(statics));
332 } 332 }
333 333
334 // TODO(ahe): This method (generateClass) should return a jsAst.Expression. 334 // TODO(ahe): This method (generateClass) should return a jsAst.Expression.
335 enclosingBuilder.addProperty(className, classBuilder.toObjectInitializer()); 335 enclosingBuilder.addProperty(className, classBuilder.toObjectInitializer());
336 336
337 String reflectionName = task.getReflectionName(classElement, className); 337 String reflectionName = task.getReflectionName(classElement, className);
338 if (reflectionName != null) { 338 if (reflectionName != null) {
339 reflectionName = '+$reflectionName';
340 } else if (classElement.isUnnamedMixinApplication &&
341 backend.isNeededForReflection(classElement)) {
342 reflectionName = '-$className';
343 }
344 if (reflectionName != null) {
339 if (!backend.isNeededForReflection(classElement)) { 345 if (!backend.isNeededForReflection(classElement)) {
340 enclosingBuilder.addProperty("+$reflectionName", js.number(0)); 346 enclosingBuilder.addProperty("$reflectionName", js.number(0));
341 } else { 347 } else {
342 List<int> types = new List<int>(); 348 List<int> types = new List<int>();
343 if (classElement.supertype != null) { 349 if (classElement.supertype != null) {
344 types.add(task.metadataEmitter.reifyType(classElement.supertype)); 350 types.add(task.metadataEmitter.reifyType(classElement.supertype));
345 } 351 }
346 for (DartType interface in classElement.interfaces) { 352 for (DartType interface in classElement.interfaces) {
347 types.add(task.metadataEmitter.reifyType(interface)); 353 types.add(task.metadataEmitter.reifyType(interface));
348 } 354 }
349 enclosingBuilder.addProperty("+$reflectionName", 355 enclosingBuilder.addProperty("$reflectionName",
350 new jsAst.ArrayInitializer.from(types.map((typeNumber) => 356 new jsAst.ArrayInitializer.from(types.map((typeNumber) =>
351 js.number(typeNumber)))); 357 js.number(typeNumber))));
352 } 358 }
353 } 359 }
354 } 360 }
355 361
356 /** 362 /**
357 * Calls [addField] for each of the fields of [element]. 363 * Calls [addField] for each of the fields of [element].
358 * 364 *
359 * [element] must be a [ClassElement] or a [LibraryElement]. 365 * [element] must be a [ClassElement] or a [LibraryElement].
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 computeTypeVariable = 598 computeTypeVariable =
593 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); 599 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index);
594 } 600 }
595 jsAst.Expression convertRtiToRuntimeType = 601 jsAst.Expression convertRtiToRuntimeType =
596 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType')); 602 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType'));
597 builder.addProperty( 603 builder.addProperty(
598 name, js.fun( 604 name, js.fun(
599 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))])); 605 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))]));
600 } 606 }
601 } 607 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698