update sample code analyzer regexp & test case (#30201)

updates the regex the analyzer uses, so it should be able to recognize expressions such as
const Foo a = Foo(); as "other code" rather than a constructor call.
This commit is contained in:
LongCatIsLooong
2019-04-01 17:27:29 -07:00
committed by GitHub
parent e3619d7a45
commit 712195b559
3 changed files with 47 additions and 5 deletions

View File

@@ -7,6 +7,10 @@
// Examples can assume:
// bool _visible = true;
// class _Text extends Text {
// const _Text(String text) : super(text);
// const _Text.__(String text) : super(text);
// }
/// A blabla that blabla its blabla blabla blabla.
///
@@ -41,3 +45,41 @@
/// )
/// ```
/// {@end-tool}
///
/// {@tool sample}
/// regular const constructor
///
/// ```dart
/// const Text('Poor wandering ones!')
/// ```
/// {@end-tool}
///
/// {@tool sample}
/// const private constructor
/// ```dart
/// const _Text('Poor wandering ones!')
/// ```
/// {@end-tool}
///
/// {@tool sample}
/// yet another const private constructor
/// ```dart
/// const _Text.__('Poor wandering ones!')
/// ```
/// {@end-tool}
///
/// {@tool sample}
/// const variable
///
/// ```dart
/// const text0 = Text('Poor wandering ones!');
/// ```
/// {@end-tool}
///
/// {@tool sample}
/// more const variables
///
/// ```dart
/// const text1 = _Text('Poor wandering ones!');
/// ```
/// {@end-tool}