File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -290,16 +290,23 @@ class Parser {
290290 }
291291
292292 String ? tag;
293- if (tagToken != null ) {
294- if (tagToken! .handle == null ) {
295- tag = tagToken! .suffix;
293+ if (tagToken
294+ case TagToken (: final handle, : final suffix, : final isVerbatim)) {
295+ /// Verbatim tags cannot be resolved as global tags.
296+ ///
297+ /// See: https://yaml.org/spec/1.2.2/#691-node-tags
298+ /// - Verbatim tags section
299+ /// - All 1.2.* versions behave this way
300+ if (handle == null || isVerbatim) {
301+ tag = suffix;
296302 } else {
297- var tagDirective = _tagDirectives[tagToken! .handle];
303+ final tagDirective = _tagDirectives[handle];
304+
298305 if (tagDirective == null ) {
299306 throw YamlException ('Undefined tag handle.' , tagToken! .span);
300307 }
301308
302- tag = tagDirective.prefix + (tagToken ? . suffix ?? '' ) ;
309+ tag = tagDirective.prefix + suffix;
303310 }
304311 }
305312
You can’t perform that action at this time.
0 commit comments