Skip to content

Commit

Permalink
Remove deprecated animation syntax (#3498)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Sep 18, 2023
1 parent dd28f4c commit 8025ec3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
18 changes: 1 addition & 17 deletions lib/src/model/documentation_comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,7 @@ mixin DocumentationComment on Documentable, Warnable, Locatable, SourceCode {
}
final positionalArgs = args.rest.sublist(0);
String uniqueId;
var wasDeprecated = false;
if (positionalArgs.length == 4) {
// Supports the original form of the animation tag for backward
// compatibility.
uniqueId = positionalArgs.removeAt(0);
wasDeprecated = true;
} else if (positionalArgs.length == 3) {
if (positionalArgs.length == 3) {
uniqueId = args['id'] ?? getUniqueId('animation_');
} else {
warn(PackageWarning.invalidParameter,
Expand Down Expand Up @@ -590,16 +584,6 @@ mixin DocumentationComment on Documentable, Warnable, Locatable, SourceCode {
}
var overlayId = '${uniqueId}_play_button_';

// Only warn about deprecation if some other warning didn't occur.
if (wasDeprecated) {
warn(PackageWarning.deprecated,
message:
'Deprecated form of @animation directive, "${basicMatch[0]}"\n'
'Animation directives are now of the form "{@animation '
'WIDTH HEIGHT URL [id=ID]}" (id is an optional '
'parameter)');
}

return modelElementRenderer.renderAnimation(
uniqueId, width, height, movieUrl, overlayId);
});
Expand Down
20 changes: 0 additions & 20 deletions test/documentation_comment_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,26 +353,6 @@ End text.'''));
'"name".'));
}

void test_animationDirectiveUsesDeprecatedSyntax() async {
await libraryModel.processComment('''
/// Text.
///
/// {@animation barHerderAnimation 100 200 http://host/path/to/video.mp4}
///
/// End text.
''');

expect(
packageGraph.packageWarningCounter.hasWarning(
libraryModel,
PackageWarning.deprecated,
'Deprecated form of @animation directive, "{@animation '
'barHerderAnimation 100 200 http://host/path/to/video.mp4}"\n'
'Animation directives are now of the form "{@animation WIDTH '
'HEIGHT URL [id=ID]}" (id is an optional parameter)'),
isTrue);
}

void test_processesTemplateDirective() async {
var doc = await libraryModel.processComment('''
/// Text.
Expand Down

0 comments on commit 8025ec3

Please sign in to comment.