Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 /// This class should morph into something that makes it easy to build | 7 /// This class should morph into something that makes it easy to build |
| 8 /// JavaScript representations of libraries, class-sides, and instance-sides. | 8 /// JavaScript representations of libraries, class-sides, and instance-sides. |
| 9 /// Initially, it is just a placeholder for code that is moved from | 9 /// Initially, it is just a placeholder for code that is moved from |
| 10 /// [CodeEmitterTask]. | 10 /// [CodeEmitterTask]. |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 isClosure: isClosure, | 407 isClosure: isClosure, |
| 408 tearOffName: tearOffName, | 408 tearOffName: tearOffName, |
| 409 canBeReflected: canBeReflected, | 409 canBeReflected: canBeReflected, |
| 410 canBeApplied: canBeApplied, | 410 canBeApplied: canBeApplied, |
| 411 needStructuredInfo: needStructuredInfo); | 411 needStructuredInfo: needStructuredInfo); |
| 412 | 412 |
| 413 } | 413 } |
| 414 | 414 |
| 415 void addMemberMethodFromInfo(MemberInfo info, ClassBuilder builder) { | 415 void addMemberMethodFromInfo(MemberInfo info, ClassBuilder builder) { |
| 416 final FunctionElement member = info.member; | 416 final FunctionElement member = info.member; |
| 417 final String name = info.name; | 417 String name = info.name; |
| 418 final FunctionSignature parameters = info.parameters; | 418 final FunctionSignature parameters = info.parameters; |
| 419 jsAst.Expression code = info.code; | 419 jsAst.Expression code = info.code; |
| 420 final bool needsStubs = info.needsStubs; | 420 final bool needsStubs = info.needsStubs; |
| 421 final bool canTearOff = info.canTearOff; | 421 final bool canTearOff = info.canTearOff; |
| 422 final bool isClosure = info.isClosure; | 422 final bool isClosure = info.isClosure; |
| 423 final String tearOffName = info.tearOffName; | 423 final String tearOffName = info.tearOffName; |
| 424 final bool canBeReflected = info.canBeReflected; | 424 final bool canBeReflected = info.canBeReflected; |
| 425 final bool canBeApplied = info.canBeApplied; | 425 final bool canBeApplied = info.canBeApplied; |
| 426 final bool needStructuredInfo = info.needStructuredInfo; | 426 final bool needStructuredInfo = info.needStructuredInfo; |
| 427 | 427 |
| 428 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name); | 428 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name); |
| 429 | 429 |
| 430 // If this member is called from a subclass via super, we have to add a | |
| 431 // renaming. This is encoded by using two names separated with a : as | |
| 432 // the property name. | |
| 433 if (backend.isAliasedSuperMember(member)) { | |
| 434 name = "$name:${namer.getNameOfAliasedSuperMember(member)}"; | |
|
floitsch
2014/11/24 10:47:52
Too far away from the code that extracts it.
Try t
ahe
2014/11/25 09:33:03
I'm concerned that using ':' (colon) here is likel
herhut
2014/11/25 14:03:19
This has been removed.
herhut
2014/11/25 14:03:19
Done.
| |
| 435 } | |
| 436 | |
| 430 if (!needStructuredInfo) { | 437 if (!needStructuredInfo) { |
| 431 compiler.dumpInfoTask.registerElementAst(member, | 438 compiler.dumpInfoTask.registerElementAst(member, |
| 432 builder.addProperty(name, code)); | 439 builder.addProperty(name, code)); |
| 433 if (needsStubs) { | 440 if (needsStubs) { |
| 434 addParameterStubs( | 441 addParameterStubs( |
| 435 member, | 442 member, |
| 436 (Selector selector, jsAst.Fun function) { | 443 (Selector selector, jsAst.Fun function) { |
| 437 compiler.dumpInfoTask.registerElementAst(member, | 444 compiler.dumpInfoTask.registerElementAst(member, |
| 438 builder.addProperty(namer.invocationName(selector), function)) ; | 445 builder.addProperty(namer.invocationName(selector), function)) ; |
|
floitsch
2014/11/24 10:47:52
long line.
herhut
2014/11/25 14:03:19
Done.
| |
| 439 }); | 446 }); |
| 440 } | 447 } |
| 441 return; | 448 return; |
| 442 } | 449 } |
| 443 | 450 |
| 444 | 451 |
| 445 // This element is needed for reflection or needs additional stubs. So we | 452 // This element is needed for reflection or needs additional stubs. So we |
| 446 // need to retain additional information. | 453 // need to retain additional information. |
| 447 | 454 |
| 448 // The information is stored in an array with this format: | 455 // The information is stored in an array with this format: |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 assert(code != null); | 640 assert(code != null); |
| 634 assert(needsStubs != null); | 641 assert(needsStubs != null); |
| 635 assert(canTearOff != null); | 642 assert(canTearOff != null); |
| 636 assert(isClosure != null); | 643 assert(isClosure != null); |
| 637 assert(tearOffName != null || !canTearOff); | 644 assert(tearOffName != null || !canTearOff); |
| 638 assert(canBeReflected != null); | 645 assert(canBeReflected != null); |
| 639 assert(canBeApplied != null); | 646 assert(canBeApplied != null); |
| 640 assert(needStructuredInfo != null); | 647 assert(needStructuredInfo != null); |
| 641 } | 648 } |
| 642 } | 649 } |
| OLD | NEW |