Skip to content

Commit f31d8ab

Browse files
Closure Teamcopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 512683823
1 parent f4edc4c commit f31d8ab

File tree

5 files changed

+8
-128
lines changed

5 files changed

+8
-128
lines changed

src/com/google/javascript/jscomp/parsing/Annotation.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ enum Annotation {
5555
MIXIN_CLASS,
5656
MIXIN_FUNCTION,
5757
MODIFIES,
58-
MODS,
5958
NG_INJECT,
6059
NO_COLLAPSE,
6160
NO_COMPILE,
@@ -140,7 +139,6 @@ enum Annotation {
140139
.put("mixinClass", Annotation.MIXIN_CLASS)
141140
.put("mixinFunction", Annotation.MIXIN_FUNCTION)
142141
.put("modifies", Annotation.MODIFIES)
143-
.put("mods", Annotation.MODS)
144142
.put("nocollapse", Annotation.NO_COLLAPSE)
145143
.put("nocompile", Annotation.NO_COMPILE)
146144
.put("nodts", Annotation.NO_DTS)

src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -549,17 +549,6 @@ private JsDocToken parseAnnotation(JsDocToken token, List<ExtendedTypeInfo> exte
549549
jsdocBuilder.recordEnhance(enhance);
550550
return token;
551551

552-
case MODS:
553-
if (jsdocBuilder.isModsRecorded()) {
554-
addParserWarning(Msg.JSDOC_MODS_EXTRA);
555-
} else {
556-
token = parseModsTag(next());
557-
}
558-
if (token != JsDocToken.EOC && token != JsDocToken.EOF) {
559-
token = eatUntilEOLIfNotAnnotation();
560-
}
561-
return token;
562-
563552
case ENUM:
564553
token = next();
565554
lineno = stream.getLineno();
@@ -1350,31 +1339,6 @@ private JsDocToken parseSuppressTag(JsDocToken token) {
13501339
}
13511340
}
13521341

1353-
/**
1354-
* Parse a {@code @mods} tag of the form {@code @mods &#123;google3.path.to.file&#125;}.
1355-
*
1356-
* @param token The current token.
1357-
*/
1358-
private JsDocToken parseModsTag(JsDocToken token) {
1359-
if (token != JsDocToken.LEFT_CURLY) {
1360-
addParserWarning(Msg.JSDOC_MODS);
1361-
return token;
1362-
}
1363-
if (!match(JsDocToken.STRING)) {
1364-
addParserWarning(Msg.JSDOC_MODS);
1365-
return token;
1366-
}
1367-
String namespace = stream.getString();
1368-
token = next();
1369-
if (!match(JsDocToken.RIGHT_CURLY)) {
1370-
addParserWarning(Msg.JSDOC_MODS);
1371-
} else {
1372-
token = next();
1373-
jsdocBuilder.recordMods(namespace);
1374-
}
1375-
return token;
1376-
}
1377-
13781342
/**
13791343
* Parse a {@code @closurePrimitive} tag
13801344
*

src/com/google/javascript/rhino/JSDocInfo.java

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import com.google.common.collect.ImmutableMap;
5151
import com.google.common.collect.ImmutableSet;
5252
import com.google.common.collect.Iterables;
53-
import com.google.errorprone.annotations.CanIgnoreReturnValue;
5453
import java.io.Serializable;
5554
import java.util.ArrayList;
5655
import java.util.Collection;
@@ -487,7 +486,6 @@ private enum IdGenerator {
487486
new Property<>("fileoverviewDescription");
488487
private static final Property<String> RETURN_DESCRIPTION = new Property<>("returnDescription");
489488
private static final Property<String> ENHANCED_NAMESPACE = new Property<>("enhance");
490-
private static final Property<String> MODS = new Property<>("mods");
491489
private static final Property<List<String>> TS_TYPES = new Property<>("tsType");
492490

493491
private static final Property<List<String>> AUTHORS = new Property<>("authors");
@@ -1375,16 +1373,6 @@ public String getEnhance() {
13751373
return ENHANCED_NAMESPACE.get(this);
13761374
}
13771375

1378-
/** Returns whether this has a modded namespace. */
1379-
public boolean hasMods() {
1380-
return MODS.get(this) != null;
1381-
}
1382-
1383-
/** Returns the modded namespace or null if none is specified. */
1384-
public String getMods() {
1385-
return MODS.get(this);
1386-
}
1387-
13881376
/** Gets the list of all markers for the documentation in this JSDoc. */
13891377
public Collection<Marker> getMarkers() {
13901378
ArrayList<Marker> markers = MARKERS.get(this);
@@ -1636,14 +1624,13 @@ public void recordOriginalCommentPosition(int position) {
16361624
*/
16371625
public boolean isPopulatedWithFileOverview() {
16381626
return populated
1639-
&& ((bits
1640-
& (Bit.FILEOVERVIEW.mask
1641-
| Bit.EXTERNS.mask
1642-
| Bit.NOCOMPILE.mask
1643-
| Bit.TYPE_SUMMARY.mask
1644-
| Bit.ENHANCED_NAMESPACE.mask))
1645-
!= 0
1646-
|| isModsRecorded());
1627+
&& (bits
1628+
& (Bit.FILEOVERVIEW.mask
1629+
| Bit.EXTERNS.mask
1630+
| Bit.NOCOMPILE.mask
1631+
| Bit.TYPE_SUMMARY.mask
1632+
| Bit.ENHANCED_NAMESPACE.mask))
1633+
!= 0;
16471634
}
16481635

16491636
/** Returns whether this builder recorded a description. */
@@ -2220,21 +2207,6 @@ public boolean recordEnhance(String namespace) {
22202207
return populateProp(ENHANCED_NAMESPACE, namespace);
22212208
}
22222209

2223-
/** Returns whether this builder recorded a modded namespace. */
2224-
public boolean isModsRecorded() {
2225-
return props.get(MODS) != null;
2226-
}
2227-
2228-
/**
2229-
* Records modded namespace.
2230-
*
2231-
* @return {@code true} If the modded namespace was recorded.
2232-
*/
2233-
@CanIgnoreReturnValue
2234-
public boolean recordMods(String namespace) {
2235-
return populateProp(MODS, RhinoStringPool.addOrGet(namespace));
2236-
}
2237-
22382210
public boolean recordLicense(String license) {
22392211
setProp(LICENSE, RhinoStringPool.addOrGet(license));
22402212
populated = true;

src/com/google/javascript/rhino/Msg.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ public enum Msg {
102102
JSDOC_MODIFIES("malformed @modifies tag"),
103103
JSDOC_MODIFIES_DUPLICATE("conflicting @modifies tag"),
104104
JSDOC_MODIFIES_UNKNOWN("unknown @modifies parameter: {0}"),
105-
JSDOC_MODS("malformed @mods tag"),
106-
JSDOC_MODS_EXTRA("extra @mods tag"),
107105
JSDOC_NAME_SYNTAX("name not recognized due to syntax error."),
108106
JSDOC_NGINJECT_EXTRA("extra @ngInject tag"),
109107
JSDOC_NOCOLLAPSE("extra @nocollapse tag"),

test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest.java

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,59 +2996,6 @@ public void testBadSuppress8() {
29962996
parse("@suppress */", "malformed @suppress tag");
29972997
}
29982998

2999-
@Test
3000-
public void testMods1() {
3001-
JSDocInfo info = parseFileOverview("@mods {ns.Foo} */");
3002-
assertThat(info.getMods()).isEqualTo("ns.Foo");
3003-
}
3004-
3005-
@Test
3006-
public void testMods2() {
3007-
JSDocInfo info = parseFileOverview("@mods {google3.path.to.file} */");
3008-
assertThat(info.getMods()).isEqualTo("google3.path.to.file");
3009-
}
3010-
3011-
@Test
3012-
public void testJsDocAfterMods() {
3013-
JSDocInfo info = parseFileOverview("@mods {ns.Foo} @modName {new_feature_flag} */");
3014-
assertThat(info.getMods()).isEqualTo("ns.Foo");
3015-
}
3016-
3017-
@Test
3018-
public void testMultipleModsTags() {
3019-
parseFileOverview("@mods {ns.Foo} \n * @mods {ns.Bar} */", "extra @mods tag");
3020-
}
3021-
3022-
@Test
3023-
public void testBadMods1() {
3024-
parseFileOverview("@mods {} */", "malformed @mods tag");
3025-
}
3026-
3027-
@Test
3028-
public void testBadMods2() {
3029-
parseFileOverview("@mods { */", "malformed @mods tag");
3030-
}
3031-
3032-
@Test
3033-
public void testBadMods3() {
3034-
parseFileOverview("@mods } */", "malformed @mods tag");
3035-
}
3036-
3037-
@Test
3038-
public void testBadMods4() {
3039-
parseFileOverview("@mods ns.Foo */", "malformed @mods tag");
3040-
}
3041-
3042-
@Test
3043-
public void testBadMods5() {
3044-
parseFileOverview("@mods {ns.Foo */", "malformed @mods tag");
3045-
}
3046-
3047-
@Test
3048-
public void testBadMods6() {
3049-
parseFileOverview("@mods ns.Foo} */", "malformed @mods tag");
3050-
}
3051-
30522999
@Test
30533000
public void testModifies1() {
30543001
JSDocInfo info = parse("@modifies {this} */");
@@ -5214,6 +5161,7 @@ public void testAllowlistedAnnotations() {
52145161
+ "* @member \n"
52155162
+ "* @memberOf \n"
52165163
+ "* @modName \n"
5164+
+ "* @mods \n"
52175165
+ "* @name \n"
52185166
+ "* @namespace \n"
52195167
+ "* @ngInject \n"

0 commit comments

Comments
 (0)