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

Unified Diff: pkg/compiler/lib/src/universe/selector.dart

Issue 2908153003: It's alive! (Closed)
Patch Set: Updated cf. comments Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/universe/selector.dart
diff --git a/pkg/compiler/lib/src/universe/selector.dart b/pkg/compiler/lib/src/universe/selector.dart
index 196489c6f64dea85dbd2ee9b4dea5c65ddc6022f..b28c1ffa29b97e0f58de8d147540ac8738df16f1 100644
--- a/pkg/compiler/lib/src/universe/selector.dart
+++ b/pkg/compiler/lib/src/universe/selector.dart
@@ -6,7 +6,7 @@ library dart2js.selector;
import '../common.dart';
import '../common/names.dart' show Names;
-import '../elements/elements.dart' show Element, Elements, FunctionSignature;
+import '../elements/elements.dart' show Elements;
import '../elements/entities.dart';
import '../elements/names.dart';
import '../elements/operators.dart';
@@ -112,30 +112,22 @@ class Selector {
return result;
}
- factory Selector.fromElement(Element element) {
+ factory Selector.fromElement(MemberEntity element) {
Name name = new Name(element.name, element.library);
if (element.isFunction) {
+ FunctionEntity function = element;
if (name == Names.INDEX_NAME) {
return new Selector.index();
} else if (name == Names.INDEX_SET_NAME) {
return new Selector.indexSet();
}
- FunctionSignature signature =
- element.asFunctionElement().functionSignature;
- int arity = signature.parameterCount;
- List<String> namedArguments = null;
- if (signature.optionalParametersAreNamed) {
- namedArguments =
- signature.orderedOptionalParameters.map((e) => e.name).toList();
- }
- if (element.isOperator) {
+ CallStructure callStructure = function.parameterStructure.callStructure;
+ if (isOperatorName(element.name)) {
// Operators cannot have named arguments, however, that doesn't prevent
// a user from declaring such an operator.
- return new Selector(SelectorKind.OPERATOR, name,
- new CallStructure(arity, namedArguments));
+ return new Selector(SelectorKind.OPERATOR, name, callStructure);
} else {
- return new Selector.call(
- name, new CallStructure(arity, namedArguments));
+ return new Selector.call(name, callStructure);
}
} else if (element.isSetter) {
return new Selector.setter(name);
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution_strategy.dart ('k') | tests/compiler/dart2js/find_my_name_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698