Commit f0f3496 1 parent d0ffb41 commit f0f3496 Copy full SHA for f0f3496
File tree 2 files changed +11
-0
lines changed
src/com/google/javascript/jscomp/parsing
test/com/google/javascript/jscomp
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -755,6 +755,7 @@ private Comment getJSDocCommentAt(SourcePosition pos) {
755
755
756
756
case CALL_EXPRESSION :
757
757
case CONDITIONAL_EXPRESSION :
758
+ case COMMA_EXPRESSION :
758
759
case BINARY_OPERATOR :
759
760
case MEMBER_EXPRESSION :
760
761
case MEMBER_LOOKUP_EXPRESSION :
@@ -955,6 +956,9 @@ private static ParseTree findNearestNode(ParseTree tree) {
955
956
case UPDATE_EXPRESSION :
956
957
tree = tree .asUpdateExpression ().operand ;
957
958
continue ;
959
+ case COMMA_EXPRESSION :
960
+ tree = tree .asCommaExpression ().expressions .get (0 );
961
+ continue ;
958
962
default :
959
963
return tree ;
960
964
}
Original file line number Diff line number Diff line change @@ -1311,4 +1311,11 @@ public void testIsUsedViaDotConstrucctor() {
1311
1311
testSame ("class Foo {/** @usedViaDotConstructor */ constructor() {} }" );
1312
1312
testWarning ("/** @usedViaDotConstructor */ function A() {}" , MISPLACED_ANNOTATION );
1313
1313
}
1314
+
1315
+ @ Test
1316
+ public void testMisplacedTypeAnnotationCommaExpression () {
1317
+ testSame ("var x = obj.method(/** @type {foo} */ (bar), baz);" );
1318
+ testSame ("var x = (/** @type {foo} */ (obj.method()), bar);" );
1319
+ testSame ("var x = (/** @type {foo} */ (bar), baz);" );
1320
+ }
1314
1321
}
You can’t perform that action at this time.
0 commit comments