File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 607
607
return true ;
608
608
} ;
609
609
610
- TagParser . prototype . parseThis = function parseAccess ( ) {
611
- // this name may be a name expression (e.g. {foo.bar})
612
- // or a name path (e.g. foo.bar)
610
+ TagParser . prototype . parseThis = function parseThis ( ) {
611
+ // this name may be a name expression (e.g. {foo.bar}),
612
+ // an union (e.g. {foo.bar|foo.baz}) or a name path (e.g. foo.bar)
613
613
var value = trim ( sliceSource ( source , index , this . _last ) ) ;
614
614
if ( value && value . charAt ( 0 ) === '{' ) {
615
615
var gotType = this . parseType ( ) ;
616
- if ( gotType && this . _tag . type . type === 'NameExpression' ) {
616
+ if ( gotType && this . _tag . type . type === 'NameExpression' || this . _tag . type . type === 'UnionType' ) {
617
617
this . _tag . name = this . _tag . type . name ;
618
618
return true ;
619
619
} else {
Original file line number Diff line number Diff line change @@ -1207,9 +1207,25 @@ describe('parse', function () {
1207
1207
] . join ( '\n' ) , { unwrap : true } ) ;
1208
1208
res . tags . should . have . length ( 1 ) ;
1209
1209
res . tags [ 0 ] . should . have . property ( 'title' , 'this' ) ;
1210
+ res . tags [ 0 ] . type . should . have . property ( 'type' , 'NameExpression' ) ;
1210
1211
res . tags [ 0 ] . should . have . property ( 'name' , 'thingName.name' ) ;
1211
1212
} ) ;
1212
1213
1214
+ it ( 'this with UnionType expression' , function ( ) {
1215
+ var res = doctrine . parse (
1216
+ [
1217
+ "/**" ,
1218
+ " * @this {thingName.name|FooBar}" ,
1219
+ "*/"
1220
+ ] . join ( '\n' ) , { unwrap : true } ) ;
1221
+ res . tags . should . have . length ( 1 ) ;
1222
+ res . tags [ 0 ] . should . have . property ( 'title' , 'this' ) ;
1223
+ res . tags [ 0 ] . type . should . have . property ( 'type' , 'UnionType' ) ;
1224
+ res . tags [ 0 ] . type . elements . should . have . length ( 2 ) ;
1225
+ res . tags [ 0 ] . type . elements . should . containEql ( { type : 'NameExpression' , name : 'thingName.name' } ) ;
1226
+ res . tags [ 0 ] . type . elements . should . containEql ( { type : 'NameExpression' , name : 'FooBar' } ) ;
1227
+ } ) ;
1228
+
1213
1229
it ( 'this error with type application' , function ( ) {
1214
1230
var res = doctrine . parse (
1215
1231
[
You can’t perform that action at this time.
0 commit comments