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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 1152903003: Create SendStructure for unary and binary in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
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 library elements.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../constants/constructors.dart'; 9 import '../constants/constructors.dart';
10 import '../helpers/helpers.dart'; // Included for debug helpers. 10 import '../helpers/helpers.dart'; // Included for debug helpers.
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 Element e = s.lookupLocalMember(memberName); 2470 Element e = s.lookupLocalMember(memberName);
2471 if (e == null) continue; 2471 if (e == null) continue;
2472 // Static members are not inherited. 2472 // Static members are not inherited.
2473 if (e.isStatic) continue; 2473 if (e.isStatic) continue;
2474 return e; 2474 return e;
2475 } 2475 }
2476 return null; 2476 return null;
2477 } 2477 }
2478 2478
2479 /** 2479 /**
2480 * Find the first member in the class chain with the given [selector]. 2480 * Find the first member in the class chain with the given [memberName].
2481 * 2481 *
2482 * This method is NOT to be used for resolving 2482 * This method is NOT to be used for resolving
2483 * unqualified sends because it does not implement the scoping 2483 * unqualified sends because it does not implement the scoping
2484 * rules, where library scope comes before superclass scope. 2484 * rules, where library scope comes before superclass scope.
2485 * 2485 *
2486 * When called on the implementation element both members declared in the 2486 * When called on the implementation element both members declared in the
2487 * origin and the patch class are returned. 2487 * origin and the patch class are returned.
2488 */ 2488 */
2489 Element lookupSelector(Selector selector) { 2489 Element lookupByName(Name memberName) {
2490 return internalLookupSelector(selector, false); 2490 return internalLookupByName(memberName, isSuperLookup: false);
2491 } 2491 }
2492 2492
2493 Element lookupSuperSelector(Selector selector) { 2493 Element lookupSuperByName(Name memberName) {
2494 return internalLookupSelector(selector, true); 2494 return internalLookupByName(memberName, isSuperLookup: true);
2495 } 2495 }
2496 2496
2497 Element internalLookupSelector(Selector selector, 2497 Element internalLookupByName(Name memberName,
2498 bool isSuperLookup) { 2498 {bool isSuperLookup}) {
karlklose 2015/05/26 08:23:32 Fix indentation. Does it fit on one line now?
Johnni Winther 2015/05/26 08:53:11 Done.
2499 String name = selector.name; 2499 String name = memberName.text;
2500 bool isPrivate = isPrivateName(name); 2500 bool isPrivate = memberName.isPrivate;
2501 LibraryElement library = selector.library; 2501 LibraryElement library = memberName.library;
2502 for (ClassElement current = isSuperLookup ? superclass : this; 2502 for (ClassElement current = isSuperLookup ? superclass : this;
2503 current != null; 2503 current != null;
2504 current = current.superclass) { 2504 current = current.superclass) {
2505 Element member = current.lookupLocalMember(name); 2505 Element member = current.lookupLocalMember(name);
2506 if (member == null && current.isPatched) { 2506 if (member == null && current.isPatched) {
2507 // Doing lookups on selectors is done after resolution, so it 2507 // Doing lookups on selectors is done after resolution, so it
2508 // is safe to look in the patch class. 2508 // is safe to look in the patch class.
2509 member = current.patch.lookupLocalMember(name); 2509 member = current.patch.lookupLocalMember(name);
2510 } 2510 }
2511 if (member == null) continue; 2511 if (member == null) continue;
2512 // Private members from a different library are not visible. 2512 // Private members from a different library are not visible.
2513 if (isPrivate && !identical(library, member.library)) continue; 2513 if (isPrivate && !identical(library, member.library)) continue;
2514 // Static members are not inherited. 2514 // Static members are not inherited.
2515 if (member.isStatic && !identical(this, current)) continue; 2515 if (member.isStatic && !identical(this, current)) continue;
2516 // If we find an abstract field we have to make sure that it has 2516 // If we find an abstract field we have to make sure that it has
2517 // the getter or setter part we're actually looking 2517 // the getter or setter part we're actually looking
2518 // for. Otherwise, we continue up the superclass chain. 2518 // for. Otherwise, we continue up the superclass chain.
2519 if (member.isAbstractField) { 2519 if (member.isAbstractField) {
2520 AbstractFieldElement field = member; 2520 AbstractFieldElement field = member;
2521 FunctionElement getter = field.getter; 2521 FunctionElement getter = field.getter;
2522 FunctionElement setter = field.setter; 2522 FunctionElement setter = field.setter;
2523 if (selector.isSetter) { 2523 if (memberName.isSetter) {
2524 // Abstract members can be defined in a super class. 2524 // Abstract members can be defined in a super class.
2525 if (setter != null && !setter.isAbstract) return setter; 2525 if (setter != null && !setter.isAbstract) {
2526 return setter;
2527 }
2526 } else { 2528 } else {
2527 assert(selector.isGetter || selector.isCall); 2529 if (getter != null && !getter.isAbstract) {
2528 if (getter != null && !getter.isAbstract) return getter; 2530 return getter;
2531 }
2529 } 2532 }
2530 // Abstract members can be defined in a super class. 2533 // Abstract members can be defined in a super class.
2531 } else if (!member.isAbstract) { 2534 } else if (!member.isAbstract) {
2532 return member; 2535 return member;
2533 } 2536 }
2534 } 2537 }
2535 return null; 2538 return null;
2536 } 2539 }
2537 2540
2538 /** 2541 /**
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 AstElement get definingElement; 3220 AstElement get definingElement;
3218 3221
3219 bool get hasResolvedAst => definingElement.hasTreeElements; 3222 bool get hasResolvedAst => definingElement.hasTreeElements;
3220 3223
3221 ResolvedAst get resolvedAst { 3224 ResolvedAst get resolvedAst {
3222 return new ResolvedAst(declaration, 3225 return new ResolvedAst(declaration,
3223 definingElement.node, definingElement.treeElements); 3226 definingElement.node, definingElement.treeElements);
3224 } 3227 }
3225 3228
3226 } 3229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698