Chromium Code Reviews| 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 = |