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

Side by Side Diff: frog/leg/elements/elements.dart

Issue 9327001: Implement super initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and update test expectations. Created 8 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
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 #library('elements'); 5 #library('elements');
6 6
7 #import('../tree/tree.dart'); 7 #import('../tree/tree.dart');
8 #import('../scanner/scannerlib.dart'); 8 #import('../scanner/scannerlib.dart');
9 #import('../leg.dart'); // TODO(karlklose): we only need type. 9 #import('../leg.dart'); // TODO(karlklose): we only need type.
10 #import('../util/util.dart'); 10 #import('../util/util.dart');
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ElementKind kind, 362 ElementKind kind,
363 Modifiers this.modifiers, 363 Modifiers this.modifiers,
364 Element enclosing) 364 Element enclosing)
365 : super(name, kind, enclosing); 365 : super(name, kind, enclosing);
366 366
367 FunctionElement.node(SourceString name, 367 FunctionElement.node(SourceString name,
368 FunctionExpression node, 368 FunctionExpression node,
369 ElementKind kind, 369 ElementKind kind,
370 Modifiers this.modifiers, 370 Modifiers this.modifiers,
371 Element enclosing) 371 Element enclosing)
372 : super(name, kind, enclosing), 372 : super(name, kind, enclosing), cachedNode = node;
373 cachedNode = node;
374 373
375 FunctionElement.from(SourceString name, 374 FunctionElement.from(SourceString name,
376 FunctionElement other, 375 FunctionElement other,
377 Element enclosing) 376 Element enclosing)
378 : super(name, other.kind, enclosing), 377 : super(name, other.kind, enclosing),
379 cachedNode = other.cachedNode, 378 cachedNode = other.cachedNode,
380 modifiers = other.modifiers, 379 modifiers = other.modifiers,
381 functionParameters = other.functionParameters; 380 functionParameters = other.functionParameters;
382 381
383 bool isInstanceMember() { 382 bool isInstanceMember() {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 554 }
556 555
557 ClassElement resolve(Compiler compiler) { 556 ClassElement resolve(Compiler compiler) {
558 if (!isResolved) { 557 if (!isResolved) {
559 compiler.resolveType(this); 558 compiler.resolveType(this);
560 isResolved = true; 559 isResolved = true;
561 } 560 }
562 return this; 561 return this;
563 } 562 }
564 563
565 Element lookupLocalMember(SourceString name) { 564 Element lookupLocalMember(SourceString memberName) {
566 return localMembers[name]; 565 return localMembers[memberName];
567 } 566 }
568 567
569 Element lookupConstructor(SourceString className, 568 Element lookupConstructor(SourceString className,
570 [SourceString constructorName = 569 [SourceString constructorName =
571 const SourceString(''), 570 const SourceString(''),
572 Element noMatch(Element)]) { 571 Element noMatch(Element)]) {
573 // TODO(karlklose): have a map from class names to a map of constructors 572 // TODO(karlklose): have a map from class names to a map of constructors
574 // instead of creating the name here? 573 // instead of creating the name here?
575 SourceString name; 574 SourceString normalizedName;
576 if (constructorName !== const SourceString('')) { 575 if (constructorName !== const SourceString('')) {
577 name = Elements.constructConstructorName(className, constructorName); 576 normalizedName = Elements.constructConstructorName(className,
577 constructorName);
578 } else { 578 } else {
579 name = className; 579 normalizedName = className;
580 } 580 }
581 Element result = constructors[name]; 581 Element result = constructors[normalizedName];
582 if (result === null && noMatch !== null) { 582 if (result === null && noMatch !== null) {
583 result = noMatch(lookupLocalMember(constructorName)); 583 result = noMatch(lookupLocalMember(constructorName));
584 } 584 }
585 return result; 585 return result;
586 } 586 }
587 587
588 bool canHaveDefaultConstructor() => constructors.length == 0; 588 bool canHaveDefaultConstructor() => constructors.length == 0;
589 589
590 SynthesizedConstructorElement getSynthesizedConstructor() { 590 SynthesizedConstructorElement getSynthesizedConstructor() {
591 if (synthesizedConstructor === null && canHaveDefaultConstructor()) { 591 if (synthesizedConstructor === null && canHaveDefaultConstructor()) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 else if (str === '>=') str = 'ge'; 681 else if (str === '>=') str = 'ge';
682 else if (str === '>') str = 'gt'; 682 else if (str === '>') str = 'gt';
683 else if (str === '<=') str = 'le'; 683 else if (str === '<=') str = 'le';
684 else if (str === '<') str = 'lt'; 684 else if (str === '<') str = 'lt';
685 else if (str === '&' || str === '&=') str = 'and'; 685 else if (str === '&' || str === '&=') str = 'and';
686 else if (str === '^' || str === '^=') str = 'xor'; 686 else if (str === '^' || str === '^=') str = 'xor';
687 else if (str === '|' || str === '|=') str = 'or'; 687 else if (str === '|' || str === '|=') str = 'or';
688 return new SourceString('$receiver\$$str'); 688 return new SourceString('$receiver\$$str');
689 } 689 }
690 } 690 }
OLDNEW
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/resolver.dart » ('j') | frog/leg/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698