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

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 350)
+++ compiler/java/com/google/dart/compiler/util/AstUtil.java (working copy)
@@ -66,6 +66,15 @@
return nameRef;
}
+ 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 newNameRef(JsExpression qualifier, JsName prop) {
JsNameRef nameRef = new JsNameRef(prop);
if (qualifier != null) {
@@ -174,8 +183,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) {
@@ -202,7 +212,15 @@
return new JsPrefixOperation(JsUnaryOperator.NOT, op1).setSourceRef(src);
}
+ public static JsExpression preinc(SourceInfo src, JsExpression op1) {
+ return new JsPrefixOperation(JsUnaryOperator.INC, op1).setSourceRef(src);
+ }
+
public static JsExpression and(SourceInfo src, JsExpression op1, JsExpression op2) {
- return new JsBinaryOperation(JsBinaryOperator.AND, op1, op2);
+ return new JsBinaryOperation(JsBinaryOperator.AND, op1, op2).setSourceRef(src);
}
+
+ public static JsExpression in(SourceInfo src, JsExpression propName, JsExpression obj) {
+ return new JsBinaryOperation(JsBinaryOperator.INOP, propName, obj).setSourceRef(src);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698