@@ -346,6 +346,7 @@ private void recordComment(int lineno, int column, String comment) {
346
346
currentJsDocComment =
347
347
new Comment (ts .tokenBeg , ts .getTokenLength (), ts .commentType , comment );
348
348
currentJsDocComment .setLineno (lineno );
349
+ currentJsDocComment .setColumn (column );
349
350
}
350
351
commentNode .setLineno (lineno );
351
352
commentNode .setColumn (column );
@@ -683,7 +684,6 @@ private AstNode parseFunctionBody(int type, FunctionNode fnNode) throws IOExcept
683
684
++nestingOfFunction ;
684
685
int pos = ts .tokenBeg ;
685
686
Block pn = new Block (pos ); // starts at LC position
686
- pn .setColumn (columnNumber ());
687
687
688
688
// Function code that is supplied as the arguments to the built-in
689
689
// Function, Generator, and AsyncFunction constructors is strict mode code
@@ -694,6 +694,7 @@ private AstNode parseFunctionBody(int type, FunctionNode fnNode) throws IOExcept
694
694
inUseStrictDirective = false ;
695
695
696
696
pn .setLineno (lineNumber ());
697
+ pn .setColumn (columnNumber ());
697
698
try {
698
699
if (isExpressionClosure ) {
699
700
AstNode returnValue = assignExpr ();
@@ -1467,9 +1468,9 @@ private SwitchStatement switchStatement() throws IOException {
1467
1468
int pos = ts .tokenBeg ;
1468
1469
1469
1470
SwitchStatement pn = new SwitchStatement (pos );
1470
- if (mustMatchToken (Token .LP , "msg.no.paren.switch" , true )) pn .setLp (ts .tokenBeg - pos );
1471
1471
pn .setLineno (lineNumber ());
1472
- pn .setColumn (ts .getTokenColumn (pos ));
1472
+ pn .setColumn (columnNumber ());
1473
+ if (mustMatchToken (Token .LP , "msg.no.paren.switch" , true )) pn .setLp (ts .tokenBeg - pos );
1473
1474
1474
1475
AstNode discriminant = expr (false );
1475
1476
pn .setExpression (discriminant );
@@ -1553,7 +1554,7 @@ private WhileLoop whileLoop() throws IOException {
1553
1554
int pos = ts .tokenBeg ;
1554
1555
WhileLoop pn = new WhileLoop (pos );
1555
1556
pn .setLineno (lineNumber ());
1556
- pn .setColumn (ts . getTokenColumn ( pos ));
1557
+ pn .setColumn (columnNumber ( ));
1557
1558
enterLoop (pn );
1558
1559
try {
1559
1560
ConditionData data = condition ();
@@ -1575,7 +1576,7 @@ private DoLoop doLoop() throws IOException {
1575
1576
int pos = ts .tokenBeg , end ;
1576
1577
DoLoop pn = new DoLoop (pos );
1577
1578
pn .setLineno (lineNumber ());
1578
- pn .setColumn (ts . getTokenColumn ( pos ));
1579
+ pn .setColumn (columnNumber ( ));
1579
1580
enterLoop (pn );
1580
1581
try {
1581
1582
AstNode body = getNextStatementAfterInlineComments (pn );
@@ -1876,7 +1877,6 @@ private TryStatement tryStatement() throws IOException {
1876
1877
catchNode .setIfPosition (guardPos - catchPos );
1877
1878
}
1878
1879
catchNode .setParens (lp , rp );
1879
- catchNode .setLineno (catchLineNum );
1880
1880
1881
1881
if (mustMatchToken (Token .RC , "msg.no.brace.after.body" , true )) tryEnd = ts .tokenEnd ;
1882
1882
catchNode .setLength (tryEnd - catchPos );
@@ -2180,7 +2180,7 @@ private AstNode defaultXmlNamespace() throws IOException {
2180
2180
consumeToken ();
2181
2181
mustHaveXML ();
2182
2182
setRequiresActivation ();
2183
- int lineno = lineNumber (), pos = ts .tokenBeg ;
2183
+ int lineno = lineNumber (), column = columnNumber (), pos = ts .tokenBeg ;
2184
2184
2185
2185
if (!(matchToken (Token .NAME , true ) && "xml" .equals (ts .getString ()))) {
2186
2186
reportError ("msg.bad.namespace" );
@@ -2197,6 +2197,7 @@ private AstNode defaultXmlNamespace() throws IOException {
2197
2197
dxmln .setOperator (Token .DEFAULTNAMESPACE );
2198
2198
dxmln .setOperand (e );
2199
2199
dxmln .setLineno (lineno );
2200
+ dxmln .setColumn (column );
2200
2201
2201
2202
ExpressionStatement es = new ExpressionStatement (dxmln , true );
2202
2203
return es ;
@@ -2354,7 +2355,6 @@ private VariableDeclaration variables(int declType, int pos, boolean isStatement
2354
2355
}
2355
2356
2356
2357
VariableInitializer vi = new VariableInitializer (kidPos , end - kidPos );
2357
- vi .setColumn (ts .getTokenColumn (kidPos ));
2358
2358
if (destructuring != null ) {
2359
2359
if (init == null && !inForInit ) {
2360
2360
reportError ("msg.destruct.assign.no.init" );
@@ -2381,6 +2381,7 @@ private VariableDeclaration variables(int declType, int pos, boolean isStatement
2381
2381
private AstNode let (boolean isStatement , int pos ) throws IOException {
2382
2382
LetNode pn = new LetNode (pos );
2383
2383
pn .setLineno (lineNumber ());
2384
+ pn .setColumn (columnNumber ());
2384
2385
if (mustMatchToken (Token .LP , "msg.no.paren.after.let" , true )) pn .setLp (ts .tokenBeg - pos );
2385
2386
pushScope (pn );
2386
2387
try {
@@ -2408,6 +2409,7 @@ private AstNode let(boolean isStatement, int pos) throws IOException {
2408
2409
// let expression in statement context
2409
2410
ExpressionStatement es = new ExpressionStatement (pn , !insideFunction ());
2410
2411
es .setLineno (pn .getLineno ());
2412
+ es .setColumn (pn .getColumn ());
2411
2413
return es ;
2412
2414
}
2413
2415
}
@@ -2871,6 +2873,7 @@ private AstNode xmlInitializer() throws IOException {
2871
2873
2872
2874
XmlLiteral pn = new XmlLiteral (pos );
2873
2875
pn .setLineno (lineNumber ());
2876
+ pn .setColumn (columnNumber ());
2874
2877
2875
2878
for (; ; tt = ts .getNextXMLToken ()) {
2876
2879
switch (tt ) {
@@ -3423,7 +3426,10 @@ private AstNode primaryExpr() throws IOException {
3423
3426
consumeToken ();
3424
3427
pos = ts .tokenBeg ;
3425
3428
end = ts .tokenEnd ;
3426
- return new KeywordLiteral (pos , end - pos , tt , ts .getTokenColumn (pos ));
3429
+ KeywordLiteral keywordLiteral = new KeywordLiteral (pos , end - pos , tt );
3430
+ keywordLiteral .setLineno (lineNumber ());
3431
+ keywordLiteral .setColumn (columnNumber ());
3432
+ return keywordLiteral ;
3427
3433
3428
3434
case Token .TEMPLATE_LITERAL :
3429
3435
consumeToken ();
@@ -4372,7 +4378,7 @@ Node destructuringAssignmentHelper(
4372
4378
String tempName ,
4373
4379
AstNode defaultValue ,
4374
4380
Transformer transformer ) {
4375
- Scope result = createScopeNode (Token .LETEXPR , left .getLineno ());
4381
+ Scope result = createScopeNode (Token .LETEXPR , left .getLineno (), left . getColumn () );
4376
4382
result .addChildToFront (new Node (Token .LET , createName (Token .NAME , tempName , right )));
4377
4383
try {
4378
4384
pushScope (result );
@@ -4591,12 +4597,13 @@ boolean destructuringObject(
4591
4597
boolean defaultValuesSetup = false ;
4592
4598
4593
4599
for (ObjectProperty prop : node .getElements ()) {
4594
- int lineno = 0 ;
4600
+ int lineno = 0 , column = 0 ;
4595
4601
// This function is sometimes called from the IRFactory
4596
4602
// when executing regression tests, and in those cases the
4597
4603
// tokenStream isn't set. Deal with it.
4598
4604
if (ts != null ) {
4599
4605
lineno = lineNumber ();
4606
+ column = columnNumber ();
4600
4607
}
4601
4608
AstNode id = prop .getLeft ();
4602
4609
@@ -4618,6 +4625,7 @@ boolean destructuringObject(
4618
4625
}
4619
4626
4620
4627
rightElem .setLineno (lineno );
4628
+ rightElem .setColumn (column );
4621
4629
if (defaultValue != null && !defaultValuesSetup ) {
4622
4630
setupDefaultValues (tempName , parent , defaultValue , setOp , transformer );
4623
4631
defaultValuesSetup = true ;
@@ -4680,10 +4688,11 @@ protected Node createNumber(double number) {
4680
4688
* @param lineno line number of source
4681
4689
* @return the created node
4682
4690
*/
4683
- protected Scope createScopeNode (int token , int lineno ) {
4691
+ protected Scope createScopeNode (int token , int lineno , int column ) {
4684
4692
Scope scope = new Scope ();
4685
4693
scope .setType (token );
4686
4694
scope .setLineno (lineno );
4695
+ scope .setColumn (column );
4687
4696
return scope ;
4688
4697
}
4689
4698
0 commit comments