Revision: 10286
Author: [email protected]
Date: Tue Jun 7 04:42:44 2011
Log: Add concrete SourceInfo for varargs in method calls
Review at http://gwt-code-reviews.appspot.com/1454801
http://code.google.com/p/google-web-toolkit/source/detail?r=10286
Modified:
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
/trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
Tue May 10 05:59:20 2011
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
Tue Jun 7 04:42:44 2011
@@ -2030,7 +2030,7 @@
}
JArrayType lastParamType = (JArrayType) typeMap.get(params[varArg]);
JNewArray newArray =
- JNewArray.createInitializers(SourceOrigin.UNKNOWN,
lastParamType, initializers);
+ JNewArray.createInitializers(call.getSourceInfo(),
lastParamType, initializers);
call.addArg(newArray);
}
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java Fri
Jun 3 15:55:09 2011
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java Tue
Jun 7 04:42:44 2011
@@ -347,8 +347,9 @@
@Override
public void endVisit(AllocationExpression x, BlockScope scope) {
try {
- List<JExpression> arguments = popCallArgs(x.arguments, x.binding);
- pushNewExpression(x, null, arguments, scope);
+ SourceInfo info = makeSourceInfo(x);
+ List<JExpression> arguments = popCallArgs(info, x.arguments,
x.binding);
+ pushNewExpression(info, x, null, arguments, scope);
} catch (Throwable e) {
throw translateException(x, e);
}
@@ -760,7 +761,7 @@
JConstructor ctor = (JConstructor) typeMap.get(x.binding);
JExpression trueQualifier = makeThisRef(info);
JMethodCall call = new JMethodCall(info, trueQualifier, ctor);
- List<JExpression> callArgs = popCallArgs(x.arguments, x.binding);
+ List<JExpression> callArgs = popCallArgs(info, x.arguments,
x.binding);
if (curClass.classType.isEnumOrSubclass() != null) {
// Enums: wire up synthetic name/ordinal params to the super
method.
@@ -1114,7 +1115,7 @@
SourceInfo info = makeSourceInfo(x);
JMethod method = typeMap.get(x.binding);
- List<JExpression> arguments = popCallArgs(x.arguments, x.binding);
+ List<JExpression> arguments = popCallArgs(info, x.arguments,
x.binding);
JExpression receiver = pop(x.receiver);
if (x.receiver instanceof ThisReference) {
if (method.isStatic()) {
@@ -1231,8 +1232,9 @@
@Override
public void endVisit(QualifiedAllocationExpression x, BlockScope
scope) {
try {
- List<JExpression> arguments = popCallArgs(x.arguments, x.binding);
- pushNewExpression(x, x.enclosingInstance(), arguments, scope);
+ SourceInfo info = makeSourceInfo(x);
+ List<JExpression> arguments = popCallArgs(info, x.arguments,
x.binding);
+ pushNewExpression(info, x, x.enclosingInstance(), arguments,
scope);
} catch (Throwable e) {
throw translateException(x, e);
}
@@ -2274,7 +2276,8 @@
return nodeStack.remove(nodeStack.size() - 1);
}
- private List<JExpression> popCallArgs(Expression[] jdtArgs,
MethodBinding binding) {
+ private List<JExpression> popCallArgs(SourceInfo info, Expression[]
jdtArgs,
+ MethodBinding binding) {
List<JExpression> args = pop(jdtArgs);
if (!binding.isVarargs()) {
return args;
@@ -2302,8 +2305,7 @@
ArrayList<JExpression> initializers = new
ArrayList<JExpression>(tail);
tail.clear();
JArrayType lastParamType = (JArrayType) typeMap.get(params[varArg]);
- JNewArray newArray =
- JNewArray.createInitializers(SourceOrigin.UNKNOWN,
lastParamType, initializers);
+ JNewArray newArray = JNewArray.createInitializers(info,
lastParamType, initializers);
args.add(newArray);
return args;
}
@@ -2447,7 +2449,7 @@
curMethod = newInfo;
}
- private void pushNewExpression(AllocationExpression x, Expression
qualifier,
+ private void pushNewExpression(SourceInfo info, AllocationExpression
x, Expression qualifier,
List<JExpression> arguments, BlockScope scope) {
TypeBinding typeBinding = x.resolvedType;
if (typeBinding.constantPoolName() == null) {
@@ -2460,7 +2462,6 @@
}
assert typeBinding.isClass() || typeBinding.isEnum();
- SourceInfo info = makeSourceInfo(x);
MethodBinding b = x.binding;
assert b.isConstructor();
JConstructor ctor = (JConstructor) typeMap.get(b);
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors