Chromium Code Reviews| Index: lib/compiler/implementation/js_backend/emitter.dart |
| =================================================================== |
| --- lib/compiler/implementation/js_backend/emitter.dart (revision 11792) |
| +++ lib/compiler/implementation/js_backend/emitter.dart (working copy) |
| @@ -9,9 +9,19 @@ |
| class ClosureInvocationElement extends FunctionElement { |
| ClosureInvocationElement(SourceString name, |
| FunctionElement other) |
| - : super.from(name, other, other.enclosingElement); |
| + : super.from(name, other, other.enclosingElement), |
| + methodElement = other; |
| isInstanceMember() => true; |
| + |
| + Element getOutermostEnclosingMemberOrTopLevel() { |
|
kasperl
2012/09/04 10:50:08
=> methodElement
ngeoffray
2012/09/04 10:53:44
Done.
|
| + return methodElement; |
| + } |
| + |
| + /** |
| + * The [member] this invocation refers to. |
| + */ |
| + Element methodElement; |
| } |
| /** |
| @@ -331,6 +341,10 @@ |
| int count = 0; |
| int indexOfLastOptionalArgumentInParameters = positionalArgumentCount - 1; |
| + TreeElements elements = |
| + compiler.enqueuer.resolution.getCachedElements(member); |
| + // Note that [elements] may be null for a synthetized [member]. |
|
kasperl
2012/09/04 10:50:08
Maybe move this comment closer to where you use el
ngeoffray
2012/09/04 10:53:44
Done.
|
| + |
| parameters.forEachParameter((Element element) { |
| String jsName = JsNames.getValid(element.name.slowToString()); |
| if (count < positionalArgumentCount) { |
| @@ -344,6 +358,10 @@ |
| // one in the real method (which is in Dart source order). |
| argumentsBuffer[count] = jsName; |
| parametersBuffer[selector.positionalArgumentCount + index] = jsName; |
| + } else if (elements != null && elements.isParameterChecked(element)) { |
| + CodeBuffer argumentBuffer = new CodeBuffer(); |
| + handler.writeConstant(argumentBuffer, SentinelConstant.SENTINEL); |
| + argumentsBuffer[count] = argumentBuffer.toString(); |
| } else { |
| Constant value = handler.initialVariableValues[element]; |
| if (value == null) { |