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

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

Issue 9359011: Capture this. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make this-capture work in the context of constructors. 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
« no previous file with comments | « no previous file | frog/leg/ssa/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) 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 && !element.isInstanceMember() 637 && !element.isInstanceMember()
638 && (element.kind === ElementKind.FUNCTION); 638 && (element.kind === ElementKind.FUNCTION);
639 } 639 }
640 640
641 static bool isInstanceMethod(Element element) { 641 static bool isInstanceMethod(Element element) {
642 return (element != null) 642 return (element != null)
643 && element.isInstanceMember() 643 && element.isInstanceMember()
644 && (element.kind === ElementKind.FUNCTION); 644 && (element.kind === ElementKind.FUNCTION);
645 } 645 }
646 646
647 static bool isInstanceSend(Send send, TreeElements elements) {
648 Element element = elements[send];
649 if (element === null) return !isClosureSend(send, elements);
650 return isInstanceMethod(element) || isInstanceField(element);
651 }
652
647 static bool isClosureSend(Send send, TreeElements elements) { 653 static bool isClosureSend(Send send, TreeElements elements) {
648 if (send.isPropertyAccess) return false; 654 if (send.isPropertyAccess) return false;
649 if (send.receiver !== null) return false; 655 if (send.receiver !== null) return false;
650 Element element = elements[send]; 656 Element element = elements[send];
651 // (o)() or foo()(). 657 // (o)() or foo()().
652 if (element === null && send.selector.asIdentifier() === null) return true; 658 if (element === null && send.selector.asIdentifier() === null) return true;
653 if (element === null) return false; 659 if (element === null) return false;
654 // foo() with foo a local or a parameter. 660 // foo() with foo a local or a parameter.
655 return element.isVariable() || element.isParameter(); 661 return element.isVariable() || element.isParameter();
656 } 662 }
(...skipping 24 matching lines...) Expand all
681 else if (str === '>=') str = 'ge'; 687 else if (str === '>=') str = 'ge';
682 else if (str === '>') str = 'gt'; 688 else if (str === '>') str = 'gt';
683 else if (str === '<=') str = 'le'; 689 else if (str === '<=') str = 'le';
684 else if (str === '<') str = 'lt'; 690 else if (str === '<') str = 'lt';
685 else if (str === '&' || str === '&=') str = 'and'; 691 else if (str === '&' || str === '&=') str = 'and';
686 else if (str === '^' || str === '^=') str = 'xor'; 692 else if (str === '^' || str === '^=') str = 'xor';
687 else if (str === '|' || str === '|=') str = 'or'; 693 else if (str === '|' || str === '|=') str = 'or';
688 return new SourceString('$receiver\$$str'); 694 return new SourceString('$receiver\$$str');
689 } 695 }
690 } 696 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698