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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart

Issue 750323003: Remove js.ArrayElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add parsing and testing of array holes, make lists non-growable Created 6 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 ClassStubGenerator get _stubGenerator => 9 ClassStubGenerator get _stubGenerator =>
10 new ClassStubGenerator(compiler, namer, backend); 10 new ClassStubGenerator(compiler, namer, backend);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (backend.isAccessibleByReflection(classElement)) { 298 if (backend.isAccessibleByReflection(classElement)) {
299 List<DartType> typeVars = classElement.typeVariables; 299 List<DartType> typeVars = classElement.typeVariables;
300 Iterable typeVariableProperties = emitter.typeVariableHandler 300 Iterable typeVariableProperties = emitter.typeVariableHandler
301 .typeVariablesOf(classElement).map(js.number); 301 .typeVariablesOf(classElement).map(js.number);
302 302
303 ClassElement superclass = classElement.superclass; 303 ClassElement superclass = classElement.superclass;
304 bool hasSuper = superclass != null; 304 bool hasSuper = superclass != null;
305 if ((!typeVariableProperties.isEmpty && !hasSuper) || 305 if ((!typeVariableProperties.isEmpty && !hasSuper) ||
306 (hasSuper && !equalElements(superclass.typeVariables, typeVars))) { 306 (hasSuper && !equalElements(superclass.typeVariables, typeVars))) {
307 classBuilder.addProperty('<>', 307 classBuilder.addProperty('<>',
308 new jsAst.ArrayInitializer.from(typeVariableProperties)); 308 new jsAst.ArrayInitializer(typeVariableProperties.toList()));
309 } 309 }
310 } 310 }
311 311
312 List<jsAst.Property> statics = new List<jsAst.Property>(); 312 List<jsAst.Property> statics = new List<jsAst.Property>();
313 ClassBuilder staticsBuilder = new ClassBuilder(classElement, namer); 313 ClassBuilder staticsBuilder = new ClassBuilder(classElement, namer);
314 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) { 314 if (emitFields(classElement, staticsBuilder, null, emitStatics: true)) {
315 jsAst.ObjectInitializer initializer = 315 jsAst.ObjectInitializer initializer =
316 staticsBuilder.toObjectInitializer(); 316 staticsBuilder.toObjectInitializer();
317 compiler.dumpInfoTask.registerElementAst(classElement, 317 compiler.dumpInfoTask.registerElementAst(classElement,
318 initializer); 318 initializer);
(...skipping 23 matching lines...) Expand all
342 enclosingBuilder.addProperty("+$reflectionName", js.number(0)); 342 enclosingBuilder.addProperty("+$reflectionName", js.number(0));
343 } else { 343 } else {
344 List<int> types = <int>[]; 344 List<int> types = <int>[];
345 if (classElement.supertype != null) { 345 if (classElement.supertype != null) {
346 types.add(emitter.metadataEmitter.reifyType(classElement.supertype)); 346 types.add(emitter.metadataEmitter.reifyType(classElement.supertype));
347 } 347 }
348 for (DartType interface in classElement.interfaces) { 348 for (DartType interface in classElement.interfaces) {
349 types.add(emitter.metadataEmitter.reifyType(interface)); 349 types.add(emitter.metadataEmitter.reifyType(interface));
350 } 350 }
351 enclosingBuilder.addProperty("+$reflectionName", 351 enclosingBuilder.addProperty("+$reflectionName",
352 new jsAst.ArrayInitializer.from(types.map(js.number))); 352 new jsAst.ArrayInitializer(types.map(js.number).toList()));
353 } 353 }
354 } 354 }
355 } 355 }
356 356
357 /** 357 /**
358 * Invokes [f] for each of the fields of [element]. 358 * Invokes [f] for each of the fields of [element].
359 * 359 *
360 * [element] must be a [ClassElement] or a [LibraryElement]. 360 * [element] must be a [ClassElement] or a [LibraryElement].
361 * 361 *
362 * If [element] is a [ClassElement], the static fields of the class are 362 * If [element] is a [ClassElement], the static fields of the class are
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); 600 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index);
601 } 601 }
602 jsAst.Expression convertRtiToRuntimeType = 602 jsAst.Expression convertRtiToRuntimeType =
603 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType')); 603 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType'));
604 compiler.dumpInfoTask.registerElementAst(element, 604 compiler.dumpInfoTask.registerElementAst(element,
605 builder.addProperty(name, 605 builder.addProperty(name,
606 js('function () { return #(#) }', 606 js('function () { return #(#) }',
607 [convertRtiToRuntimeType, computeTypeVariable]))); 607 [convertRtiToRuntimeType, computeTypeVariable])));
608 } 608 }
609 } 609 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698