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

Unified Diff: compiler/java/com/google/dart/compiler/util/AstUtil.java

Issue 8232014: Fix named parameters handling of values that are falsy in JS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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: compiler/java/com/google/dart/compiler/util/AstUtil.java
===================================================================
--- compiler/java/com/google/dart/compiler/util/AstUtil.java (revision 305)
+++ compiler/java/com/google/dart/compiler/util/AstUtil.java (working copy)
@@ -66,11 +66,21 @@
return nameRef;
}
- public static JsNameRef newNameRef(JsExpression qualifier, JsName prop) {
+ public static JsNameRef nameref(SourceInfo info, JsName qualifier, JsName prop) {
JsNameRef nameRef = new JsNameRef(prop);
if (qualifier != null) {
+ nameRef.setQualifier(qualifier.makeRef());
+ }
+ nameRef.setSourceRef(info);
+ return nameRef;
+ }
+
+ public static JsNameRef nameref(SourceInfo info, JsExpression qualifier, JsName prop) {
jat 2011/10/11 20:28:23 Since newNameRef is going away, I suggest either l
John Lenz 2011/10/11 20:35:55 Done.
+ JsNameRef nameRef = new JsNameRef(prop);
+ if (qualifier != null) {
nameRef.setQualifier(qualifier);
}
+ nameRef.setSourceRef(info);
return nameRef;
}
@@ -174,8 +184,9 @@
return (JsInvocation) newInvocation(target, params).setSourceRef(src);
}
- public static JsExpression comma(SourceInfo src, JsExpression op1, JsExpression op2) {
- return new JsBinaryOperation(JsBinaryOperator.COMMA, op1, op2).setSourceRef(src);
+ public static JsBinaryOperation comma(SourceInfo src, JsExpression op1, JsExpression op2) {
+ return (JsBinaryOperation)new JsBinaryOperation(JsBinaryOperator.COMMA, op1, op2)
+ .setSourceRef(src);
}
public static JsNameRef nameref(SourceInfo src, String name) {
@@ -205,4 +216,8 @@
public static JsExpression and(SourceInfo src, JsExpression op1, JsExpression op2) {
return new JsBinaryOperation(JsBinaryOperator.AND, op1, op2);
}
+
+ public static JsExpression in(SourceInfo src, JsExpression op1, JsExpression op2) {
jat 2011/10/11 20:28:23 op1 and op2 could have more useful names, perhaps
John Lenz 2011/10/11 20:35:55 used "propName" and "obj"
+ return new JsBinaryOperation(JsBinaryOperator.INOP, op1, op2).setSourceRef(src);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698