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

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

Issue 881363006: Store the aliasName of a method in the model. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: REBASE Created 5 years, 10 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 | pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart2js.new_js_emitter.model; 5 library dart2js.new_js_emitter.model;
6 6
7 import '../js/js.dart' as js show Expression; 7 import '../js/js.dart' as js show Expression;
8 import '../constants/values.dart' show ConstantValue; 8 import '../constants/values.dart' show ConstantValue;
9 9
10 import '../deferred_load.dart' show OutputUnit; 10 import '../deferred_load.dart' show OutputUnit;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 final js.Expression code; 328 final js.Expression code;
329 329
330 Method(this.element, this.name, this.code); 330 Method(this.element, this.name, this.code);
331 } 331 }
332 332
333 /// A method that corresponds to a method in the original Dart program. 333 /// A method that corresponds to a method in the original Dart program.
334 class DartMethod extends Method { 334 class DartMethod extends Method {
335 final bool needsTearOff; 335 final bool needsTearOff;
336 final String tearOffName; 336 final String tearOffName;
337 final List<ParameterStubMethod> parameterStubs; 337 final List<ParameterStubMethod> parameterStubs;
338 // TODO(herhut): Directly store aliases instead.
339 final bool canBeApplied; 338 final bool canBeApplied;
340 final bool canBeReflected; 339 final bool canBeReflected;
341 340
342 // If this method can be torn off, contains the name of the corresponding 341 // If this method can be torn off, contains the name of the corresponding
343 // call method. For example, for the member `foo$1$name` it would be 342 // call method. For example, for the member `foo$1$name` it would be
344 // `call$1$name` (in unminified mode). 343 // `call$1$name` (in unminified mode).
345 final String callName; 344 final String callName;
346 345
347 DartMethod(Element element, String name, js.Expression code, 346 DartMethod(Element element, String name, js.Expression code,
348 this.parameterStubs, this.callName, 347 this.parameterStubs, this.callName,
349 {this.needsTearOff, this.tearOffName, this.canBeApplied, 348 {this.needsTearOff, this.tearOffName, this.canBeApplied,
350 this.canBeReflected}) 349 this.canBeReflected})
351 : super(element, name, code) { 350 : super(element, name, code) {
352 assert(needsTearOff != null); 351 assert(needsTearOff != null);
353 assert(!needsTearOff || tearOffName != null); 352 assert(!needsTearOff || tearOffName != null);
354 assert(canBeApplied != null); 353 assert(canBeApplied != null);
355 assert(canBeReflected != null); 354 assert(canBeReflected != null);
356 } 355 }
357 } 356 }
358 357
359 class InstanceMethod extends DartMethod { 358 class InstanceMethod extends DartMethod {
360 // TODO(herhut): Directly store aliases instead. 359 /// An alternative name for this method. This is used to model calls to
361 final bool hasSuperAlias; 360 /// a method via `super`. If [aliasName] is non-null, the emitter has to
361 /// ensure that this method is registered on the prototype under both [name]
362 /// and [aliasName].
363 final String aliasName;
362 final bool isClosure; 364 final bool isClosure;
363 365
366
364 InstanceMethod(Element element, String name, js.Expression code, 367 InstanceMethod(Element element, String name, js.Expression code,
365 List<ParameterStubMethod> parameterStubs, 368 List<ParameterStubMethod> parameterStubs,
366 String callName, 369 String callName,
367 {bool needsTearOff, 370 {bool needsTearOff,
368 String tearOffName, 371 String tearOffName,
369 this.hasSuperAlias, 372 this.aliasName,
370 bool canBeApplied, 373 bool canBeApplied,
371 bool canBeReflected, 374 bool canBeReflected,
372 this.isClosure}) 375 this.isClosure})
373 : super(element, name, code, parameterStubs, callName, 376 : super(element, name, code, parameterStubs, callName,
374 needsTearOff: needsTearOff, 377 needsTearOff: needsTearOff,
375 tearOffName: tearOffName, 378 tearOffName: tearOffName,
376 canBeApplied: canBeApplied, 379 canBeApplied: canBeApplied,
377 canBeReflected: canBeReflected) { 380 canBeReflected: canBeReflected) {
378 assert(hasSuperAlias != null);
379 assert(isClosure != null); 381 assert(isClosure != null);
380 } 382 }
381 } 383 }
382 384
383 /// A method that is generated by the backend and has not direct correspondence 385 /// A method that is generated by the backend and has not direct correspondence
384 /// to a method in the original Dart program. Examples are getter and setter 386 /// to a method in the original Dart program. Examples are getter and setter
385 /// stubs and stubs to dispatch calls to methods with optional parameters. 387 /// stubs and stubs to dispatch calls to methods with optional parameters.
386 class StubMethod extends Method { 388 class StubMethod extends Method {
387 StubMethod(String name, js.Expression code, 389 StubMethod(String name, js.Expression code,
388 {Element element}) 390 {Element element})
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 tearOffName : tearOffName, 429 tearOffName : tearOffName,
428 canBeApplied : canBeApplied, 430 canBeApplied : canBeApplied,
429 canBeReflected : canBeReflected); 431 canBeReflected : canBeReflected);
430 } 432 }
431 433
432 class StaticStubMethod extends StubMethod implements StaticMethod { 434 class StaticStubMethod extends StubMethod implements StaticMethod {
433 Holder holder; 435 Holder holder;
434 StaticStubMethod(String name, this.holder, js.Expression code) 436 StaticStubMethod(String name, this.holder, js.Expression code)
435 : super(name, code); 437 : super(name, code);
436 } 438 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698