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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 24745003: Implement invoking methods with optional arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | dart/tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 308cfe4686771bc7e29242580a8ff1620e063159..b600595022727ae1f9c68795352634b716bee59a 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -1134,8 +1134,9 @@ class CodeEmitterTask extends CompilerTask {
// canonicalized, we would still need this cache: a typed selector
// on A and a typed selector on B could yield the same stub.
Set<String> generatedStubNames = new Set<String>();
- if (compiler.enabledFunctionApply
- && member.name == namer.closureInvocationSelectorName) {
+ if (backend.isNeededForReflection(member) ||
+ (compiler.enabledFunctionApply &&
+ member.name == namer.closureInvocationSelectorName)) {
// If [Function.apply] is called, we pessimistically compile all
// possible stubs for this closure.
FunctionSignature signature = member.computeSignature(compiler);
@@ -1160,8 +1161,8 @@ class CodeEmitterTask extends CompilerTask {
Set<Selector> computeSeenNamedSelectors(FunctionElement element) {
Set<Selector> selectors = compiler.codegenWorld.invokedNames[element.name];
- if (selectors == null) return null;
Set<Selector> result = new Set<Selector>();
+ if (selectors == null) return result;
for (Selector selector in selectors) {
if (!selector.applies(element, compiler)) continue;
result.add(selector);
@@ -1361,6 +1362,14 @@ class CodeEmitterTask extends CompilerTask {
requiredParameterCount,
names);
namedArguments = namedParametersAsReflectionNames(selector);
+ } else {
+ // Named parameters are handled differently by mirrors. For unnamed
+ // parameters, they are actually required if invoked
+ // reflectively. Also, if you have a method c(x) and c([x]) they both
+ // get the same mangled name, so they must have the same reflection
+ // name.
+ requiredParameterCount += optionalParameterCount;
+ optionalParameterCount = 0;
ngeoffray 2013/09/26 12:32:04 Add a TODO/FIXME: is optionalParameterCount used?
ahe 2013/09/26 12:43:21 Done.
}
}
String suffix =
« no previous file with comments | « no previous file | dart/tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698