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

Side by Side Diff: lib/compiler/implementation/js_backend/emitter.dart

Issue 10996062: Use static final empty Modifier instead of null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Missing uses fixed. Created 8 years, 2 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 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 490 }
491 } 491 }
492 492
493 bool instanceFieldNeedsGetter(Element member) { 493 bool instanceFieldNeedsGetter(Element member) {
494 assert(member.isField()); 494 assert(member.isField());
495 return compiler.codegenWorld.hasInvokedGetter(member, compiler); 495 return compiler.codegenWorld.hasInvokedGetter(member, compiler);
496 } 496 }
497 497
498 bool instanceFieldNeedsSetter(Element member) { 498 bool instanceFieldNeedsSetter(Element member) {
499 assert(member.isField()); 499 assert(member.isField());
500 return (member.modifiers === null || !member.modifiers.isFinalOrConst()) 500 return (!member.modifiers.isFinalOrConst())
501 && compiler.codegenWorld.hasInvokedSetter(member, compiler); 501 && compiler.codegenWorld.hasInvokedSetter(member, compiler);
502 } 502 }
503 503
504 String compiledFieldName(Element member) { 504 String compiledFieldName(Element member) {
505 assert(member.isField()); 505 assert(member.isField());
506 return member.isNative() 506 return member.isNative()
507 ? member.name.slowToString() 507 ? member.name.slowToString()
508 : namer.getName(member); 508 : namer.getName(member);
509 } 509 }
510 510
511 /** 511 /**
512 * Documentation wanted -- johnniwinther 512 * Documentation wanted -- johnniwinther
513 * 513 *
514 * Invariant: [member] must be a declaration element. 514 * Invariant: [member] must be a declaration element.
515 */ 515 */
516 void addInstanceMember(Element member, 516 void addInstanceMember(Element member,
517 DefineMemberFunction defineInstanceMember) { 517 DefineMemberFunction defineInstanceMember) {
518 assert(invariant(member, member.isDeclaration)); 518 assert(invariant(member, member.isDeclaration));
519 // TODO(floitsch): we don't need to deal with members of 519 // TODO(floitsch): we don't need to deal with members of
520 // uninstantiated classes, that have been overwritten by subclasses. 520 // uninstantiated classes, that have been overwritten by subclasses.
521 521
522 if (member.isFunction() 522 if (member.isFunction()
523 || member.isGenerativeConstructorBody() 523 || member.isGenerativeConstructorBody()
524 || member.isGetter() 524 || member.isGetter()
525 || member.isSetter()) { 525 || member.isSetter()) {
526 if (member.modifiers !== null && member.modifiers.isAbstract()) return; 526 if (member.modifiers.isAbstract()) return;
527 CodeBuffer codeBuffer = compiler.codegenWorld.generatedCode[member]; 527 CodeBuffer codeBuffer = compiler.codegenWorld.generatedCode[member];
528 if (codeBuffer == null) return; 528 if (codeBuffer == null) return;
529 defineInstanceMember(namer.getName(member), codeBuffer); 529 defineInstanceMember(namer.getName(member), codeBuffer);
530 codeBuffer = compiler.codegenWorld.generatedBailoutCode[member]; 530 codeBuffer = compiler.codegenWorld.generatedBailoutCode[member];
531 if (codeBuffer !== null) { 531 if (codeBuffer !== null) {
532 defineInstanceMember(namer.getBailoutName(member), codeBuffer); 532 defineInstanceMember(namer.getBailoutName(member), codeBuffer);
533 } 533 }
534 FunctionElement function = member; 534 FunctionElement function = member;
535 FunctionSignature parameters = function.computeSignature(compiler); 535 FunctionSignature parameters = function.computeSignature(compiler);
536 if (!parameters.optionalParameters.isEmpty()) { 536 if (!parameters.optionalParameters.isEmpty()) {
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 const String HOOKS_API_USAGE = """ 1435 const String HOOKS_API_USAGE = """
1436 // Generated by dart2js, the Dart to JavaScript compiler. 1436 // Generated by dart2js, the Dart to JavaScript compiler.
1437 // The code supports the following hooks: 1437 // The code supports the following hooks:
1438 // dartPrint(message) - if this function is defined it is called 1438 // dartPrint(message) - if this function is defined it is called
1439 // instead of the Dart [print] method. 1439 // instead of the Dart [print] method.
1440 // dartMainRunner(main) - if this function is defined, the Dart [main] 1440 // dartMainRunner(main) - if this function is defined, the Dart [main]
1441 // method will not be invoked directly. 1441 // method will not be invoked directly.
1442 // Instead, a closure that will invoke [main] is 1442 // Instead, a closure that will invoke [main] is
1443 // passed to [dartMainRunner]. 1443 // passed to [dartMainRunner].
1444 """; 1444 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698