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

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

Issue 1299413002: Move common identifiers, names and selectors to a separate library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Mixins that implement convenience methods on [Element] subclasses. 5 /// Mixins that implement convenience methods on [Element] subclasses.
6 6
7 library elements.common; 7 library elements.common;
8 8
9 import '../common/names.dart' show
10 Names;
9 import '../compiler.dart' show 11 import '../compiler.dart' show
10 Compiler, 12 Compiler,
11 isPrivateName; 13 isPrivateName;
12 import '../dart_types.dart' show 14 import '../dart_types.dart' show
13 DartType, 15 DartType,
14 InterfaceType, 16 InterfaceType,
15 FunctionType; 17 FunctionType;
16 import '../util/util.dart' show 18 import '../util/util.dart' show
17 Link; 19 Link;
18 20
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // Use [declaration] for both [this] and [cls], because 428 // Use [declaration] for both [this] and [cls], because
427 // declaration classes hold the superclass hierarchy. 429 // declaration classes hold the superclass hierarchy.
428 cls = cls.declaration; 430 cls = cls.declaration;
429 for (ClassElement s = declaration; s != null; s = s.superclass) { 431 for (ClassElement s = declaration; s != null; s = s.superclass) {
430 if (identical(s, cls)) return true; 432 if (identical(s, cls)) return true;
431 } 433 }
432 return false; 434 return false;
433 } 435 }
434 436
435 FunctionType get callType { 437 FunctionType get callType {
436 MemberSignature member = 438 MemberSignature member = lookupInterfaceMember(Names.call);
437 lookupInterfaceMember(const PublicName(Compiler.CALL_OPERATOR_NAME));
438 return member != null && member.isMethod ? member.type : null; 439 return member != null && member.isMethod ? member.type : null;
439 } 440 }
440 } 441 }
441 442
442 abstract class FunctionSignatureCommon implements FunctionSignature { 443 abstract class FunctionSignatureCommon implements FunctionSignature {
443 void forEachRequiredParameter(void function(Element parameter)) { 444 void forEachRequiredParameter(void function(Element parameter)) {
444 requiredParameters.forEach(function); 445 requiredParameters.forEach(function);
445 } 446 }
446 447
447 void forEachOptionalParameter(void function(Element parameter)) { 448 void forEachOptionalParameter(void function(Element parameter)) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 // this signature must not have more required parameters. Having more 492 // this signature must not have more required parameters. Having more
492 // optional parameters is not a problem, they simply are never provided 493 // optional parameters is not a problem, they simply are never provided
493 // by call sites of a call to a method with the other signature. 494 // by call sites of a call to a method with the other signature.
494 int otherTotalCount = signature.parameterCount; 495 int otherTotalCount = signature.parameterCount;
495 return requiredParameterCount <= otherTotalCount 496 return requiredParameterCount <= otherTotalCount
496 && parameterCount >= otherTotalCount; 497 && parameterCount >= otherTotalCount;
497 } 498 }
498 return true; 499 return true;
499 } 500 }
500 } 501 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698