File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed
Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -1259,7 +1259,6 @@ private int seekContent() {
12591259 private JSDocTypeExpression parseType (String title , int last ) throws ParseError {
12601260 char ch ;
12611261 int brace ;
1262- StringBuilder type ;
12631262 boolean direct = false ;
12641263
12651264 // search '{'
@@ -1280,35 +1279,34 @@ private JSDocTypeExpression parseType(String title, int last) throws ParseError
12801279 if (!direct ) {
12811280 // type expression { is found
12821281 brace = 1 ;
1283- type = new StringBuilder () ;
1282+ int startIndex = index ;
12841283 while (index < last ) {
12851284 ch = source .charAt (index );
1286- if (isLineTerminator (ch )) {
1287- advance ();
1288- } else {
1289- if (ch == '}' ) {
1290- brace -= 1 ;
1291- if (brace == 0 ) {
1292- advance ();
1293- break ;
1294- }
1295- } else if (ch == '{' ) {
1296- brace += 1 ;
1285+ if (ch == '}' ) {
1286+ brace -= 1 ;
1287+ if (brace == 0 ) {
1288+ advance ();
1289+ break ;
12971290 }
1298- type .append (advance ());
1291+ } else if (ch == '{' ) {
1292+ brace += 1 ;
12991293 }
1294+ advance ();
13001295 }
13011296
13021297 if (brace != 0 ) {
13031298 // braces is not balanced
13041299 return throwError ("Braces are not balanced" );
13051300 }
13061301
1302+ // Get the type as a string, ignoring the last '}'
1303+ String type = source .substring (startIndex , index - 1 );
1304+
13071305 try {
13081306 if (isParamTitle (title )) {
1309- return typed .parseParamType (type . toString () );
1307+ return typed .parseParamType (type );
13101308 }
1311- return typed .parseType (type . toString () );
1309+ return typed .parseType (type );
13121310 } catch (ParseError e ) {
13131311 // parse failed
13141312 return null ;
You can’t perform that action at this time.
0 commit comments