Make expression-detection in doc verifier more discriminating.

The existing behavior treated `var x = e; // comment` as an expression,
and failed spectacularly to insert it after a `return`.
The new behavior detects a `;` anywhere in the single line, not just
at the end, as a sign that a single line is probably not an expression.

Change-Id: Ice5abc8dc802db36511dc3cdcca162dc0e8a8f13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229155
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
diff --git a/tools/verify_docs/bin/verify_docs.dart b/tools/verify_docs/bin/verify_docs.dart
index 8cba35f..ebe1ce7 100755
--- a/tools/verify_docs/bin/verify_docs.dart
+++ b/tools/verify_docs/bin/verify_docs.dart
@@ -270,8 +270,8 @@
         template = 'none';
       } else if (hasTopDeclaration) {
         template = 'top';
-      } else if (lines.length == 1 && !lines.first.trim().endsWith(';')) {
-        // If single line with no trailing `;`, assume expression.
+      } else if (lines.length == 1 && !lines.first.contains(';')) {
+        // If single line with no `;`, assume expression.
         template = 'expression';
       } else {
         // Otherwise default to `main`.