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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java

Issue 9183002: Remove the type token used to pass element information to arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address floitsch's comments Created 8 years, 11 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 | compiler/lib/corelib_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
diff --git a/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java b/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
index 87ae13592b62927c983f588aeb5f2ec2b3fdcd55..94a479721841790dd84a7353bb300fd281a59913 100644
--- a/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
+++ b/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
@@ -1037,9 +1037,11 @@ public class GenerateJavascriptAST {
// Add the arguments to the constructor invocation. Note that the constructor call is still
// missing the 'tmp' variable. We will add it later.
List<DartParameter> params = x.getFunction().getParams();
+ List<JsName> jsArgNames = new ArrayList<JsName>();
for (DartParameter p : params) {
// TODO(ngeoffray): We should actually copy the arguments. See b/4424659.
JsName argName = getJsName(p.getNormalizedNode().getSymbol());
+ jsArgNames.add(argName);
constructorInvocation.getArguments().add(argName.makeRef());
}
@@ -1058,6 +1060,16 @@ public class GenerateJavascriptAST {
addInitializers(x, factoryFunction, tempVar);
rtt.maybeAddClassRuntimeTypeToConstructor(classElement, factoryFunction, tempVar.makeRef());
JsNew jsNew = new JsNew(curClassJsName.makeRef());
+ if (classElement.getNativeName() != null && x.getFunction().getBody() == null) {
+ /*
+ * For native classes with bodyless constructors, we pass the user-declared arguments of
+ * the factory method to the native "new" expression.
+ */
+ List<JsExpression> newArguments = jsNew.getArguments();
+ for (JsName jsArgName : jsArgNames) {
+ newArguments.add(jsArgName.makeRef());
+ }
+ }
factoryFunction.getBody().getStatements().add(0, AstUtil.newVar(x, tempVar, jsNew));
}
« no previous file with comments | « no previous file | compiler/lib/corelib_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698