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

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

Issue 10911062: Codegen support for the argument definition test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
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) {

Powered by Google App Engine
This is Rietveld 408576698