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); |
+ } |
} |