mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Fix for highlighting mixin names.
Change-Id: Idadb02aa1b86525fde307a5eddc8876f152d1b31 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291045 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
6f3f4b598f
commit
edccf64f54
|
@ -4791,7 +4791,7 @@ a:focus, a:hover {
|
|||
</dd><dt class="value">METHOD_STATIC</dt><dd>
|
||||
|
||||
<p>Deprecated - no longer sent.</p>
|
||||
</dd><dt class="value">PARAMETER</dt><dd>
|
||||
</dd><dt class="value">MIXIN</dt><dt class="value">PARAMETER</dt><dd>
|
||||
|
||||
<p>Deprecated - no longer sent.</p>
|
||||
</dd><dt class="value">SETTER_DECLARATION</dt><dd>
|
||||
|
|
|
@ -1146,6 +1146,7 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
|
|||
void visitMixinDeclaration(MixinDeclaration node) {
|
||||
computer._addRegion_token(node.baseKeyword, HighlightRegionType.BUILT_IN);
|
||||
computer._addRegion_token(node.mixinKeyword, HighlightRegionType.BUILT_IN);
|
||||
computer._addRegion_token(node.name, HighlightRegionType.MIXIN);
|
||||
super.visitMixinDeclaration(node);
|
||||
}
|
||||
|
||||
|
|
|
@ -1433,14 +1433,6 @@ class C {
|
|||
assertHasRegion(HighlightRegionType.KEYWORD, 'late');
|
||||
}
|
||||
|
||||
Future<void> test_KEYWORD_mixin() async {
|
||||
addTestFile('''
|
||||
mixin M {}
|
||||
''');
|
||||
await prepareHighlights();
|
||||
assertHasRegion(HighlightRegionType.BUILT_IN, 'mixin');
|
||||
}
|
||||
|
||||
Future<void> test_KEYWORD_required() async {
|
||||
addTestFile('''
|
||||
void f({required int x}) {}
|
||||
|
@ -1590,6 +1582,33 @@ void f(p) {
|
|||
assertHasRegion(HighlightRegionType.INSTANCE_METHOD_REFERENCE, 'add(null)');
|
||||
}
|
||||
|
||||
Future<void> test_mixin() async {
|
||||
var testCode = TestCode.parse(r'''
|
||||
mixin M on int {}
|
||||
''');
|
||||
addTestFile(testCode.code);
|
||||
await prepareHighlights();
|
||||
assertHighlightText(testCode, -1, r'''
|
||||
0 + 5 |mixin| BUILT_IN
|
||||
6 + 1 |M| MIXIN
|
||||
8 + 2 |on| BUILT_IN
|
||||
11 + 3 |int| CLASS
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_mixin_base() async {
|
||||
var testCode = TestCode.parse(r'''
|
||||
base mixin M {}
|
||||
''');
|
||||
addTestFile(testCode.code);
|
||||
await prepareHighlights();
|
||||
assertHighlightText(testCode, -1, r'''
|
||||
0 + 4 |base| BUILT_IN
|
||||
5 + 5 |mixin| BUILT_IN
|
||||
11 + 1 |M| MIXIN
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_namedExpression_namedParameter() async {
|
||||
addTestFile('''
|
||||
void f({int a}) {}
|
||||
|
|
|
@ -843,6 +843,7 @@ final Matcher isHighlightRegion = LazyMatcher(() => MatchesJsonObject(
|
|||
/// METHOD_DECLARATION
|
||||
/// METHOD_DECLARATION_STATIC
|
||||
/// METHOD_STATIC
|
||||
/// MIXIN
|
||||
/// PARAMETER
|
||||
/// SETTER_DECLARATION
|
||||
/// TOP_LEVEL_VARIABLE
|
||||
|
@ -926,6 +927,7 @@ final Matcher isHighlightRegionType = MatchesEnum('HighlightRegionType', [
|
|||
'METHOD_DECLARATION',
|
||||
'METHOD_DECLARATION_STATIC',
|
||||
'METHOD_STATIC',
|
||||
'MIXIN',
|
||||
'PARAMETER',
|
||||
'SETTER_DECLARATION',
|
||||
'TOP_LEVEL_VARIABLE',
|
||||
|
|
|
@ -158,6 +158,8 @@ public class HighlightRegionType {
|
|||
*/
|
||||
public static final String METHOD_STATIC = "METHOD_STATIC";
|
||||
|
||||
public static final String MIXIN = "MIXIN";
|
||||
|
||||
/**
|
||||
* Deprecated - no longer sent.
|
||||
*/
|
||||
|
|
|
@ -1935,6 +1935,7 @@ class HighlightRegion implements HasToJson {
|
|||
/// METHOD_DECLARATION
|
||||
/// METHOD_DECLARATION_STATIC
|
||||
/// METHOD_STATIC
|
||||
/// MIXIN
|
||||
/// PARAMETER
|
||||
/// SETTER_DECLARATION
|
||||
/// TOP_LEVEL_VARIABLE
|
||||
|
@ -2133,6 +2134,8 @@ class HighlightRegionType implements Enum {
|
|||
static const HighlightRegionType METHOD_STATIC =
|
||||
HighlightRegionType._('METHOD_STATIC');
|
||||
|
||||
static const HighlightRegionType MIXIN = HighlightRegionType._('MIXIN');
|
||||
|
||||
/// Deprecated - no longer sent.
|
||||
static const HighlightRegionType PARAMETER =
|
||||
HighlightRegionType._('PARAMETER');
|
||||
|
@ -2271,6 +2274,7 @@ class HighlightRegionType implements Enum {
|
|||
METHOD_DECLARATION,
|
||||
METHOD_DECLARATION_STATIC,
|
||||
METHOD_STATIC,
|
||||
MIXIN,
|
||||
PARAMETER,
|
||||
SETTER_DECLARATION,
|
||||
TOP_LEVEL_VARIABLE,
|
||||
|
@ -2416,6 +2420,8 @@ class HighlightRegionType implements Enum {
|
|||
return METHOD_DECLARATION_STATIC;
|
||||
case 'METHOD_STATIC':
|
||||
return METHOD_STATIC;
|
||||
case 'MIXIN':
|
||||
return MIXIN;
|
||||
case 'PARAMETER':
|
||||
return PARAMETER;
|
||||
case 'SETTER_DECLARATION':
|
||||
|
|
|
@ -1449,7 +1449,7 @@ a:focus, a:hover {
|
|||
</dd><dt class="value">METHOD_STATIC</dt><dd>
|
||||
|
||||
<p>Deprecated - no longer sent.</p>
|
||||
</dd><dt class="value">PARAMETER</dt><dd>
|
||||
</dd><dt class="value">MIXIN</dt><dt class="value">PARAMETER</dt><dd>
|
||||
|
||||
<p>Deprecated - no longer sent.</p>
|
||||
</dd><dt class="value">SETTER_DECLARATION</dt><dd>
|
||||
|
|
|
@ -1935,6 +1935,7 @@ class HighlightRegion implements HasToJson {
|
|||
/// METHOD_DECLARATION
|
||||
/// METHOD_DECLARATION_STATIC
|
||||
/// METHOD_STATIC
|
||||
/// MIXIN
|
||||
/// PARAMETER
|
||||
/// SETTER_DECLARATION
|
||||
/// TOP_LEVEL_VARIABLE
|
||||
|
@ -2133,6 +2134,8 @@ class HighlightRegionType implements Enum {
|
|||
static const HighlightRegionType METHOD_STATIC =
|
||||
HighlightRegionType._('METHOD_STATIC');
|
||||
|
||||
static const HighlightRegionType MIXIN = HighlightRegionType._('MIXIN');
|
||||
|
||||
/// Deprecated - no longer sent.
|
||||
static const HighlightRegionType PARAMETER =
|
||||
HighlightRegionType._('PARAMETER');
|
||||
|
@ -2271,6 +2274,7 @@ class HighlightRegionType implements Enum {
|
|||
METHOD_DECLARATION,
|
||||
METHOD_DECLARATION_STATIC,
|
||||
METHOD_STATIC,
|
||||
MIXIN,
|
||||
PARAMETER,
|
||||
SETTER_DECLARATION,
|
||||
TOP_LEVEL_VARIABLE,
|
||||
|
@ -2416,6 +2420,8 @@ class HighlightRegionType implements Enum {
|
|||
return METHOD_DECLARATION_STATIC;
|
||||
case 'METHOD_STATIC':
|
||||
return METHOD_STATIC;
|
||||
case 'MIXIN':
|
||||
return MIXIN;
|
||||
case 'PARAMETER':
|
||||
return PARAMETER;
|
||||
case 'SETTER_DECLARATION':
|
||||
|
|
|
@ -420,6 +420,7 @@ final Matcher isHighlightRegion = LazyMatcher(() => MatchesJsonObject(
|
|||
/// METHOD_DECLARATION
|
||||
/// METHOD_DECLARATION_STATIC
|
||||
/// METHOD_STATIC
|
||||
/// MIXIN
|
||||
/// PARAMETER
|
||||
/// SETTER_DECLARATION
|
||||
/// TOP_LEVEL_VARIABLE
|
||||
|
@ -503,6 +504,7 @@ final Matcher isHighlightRegionType = MatchesEnum('HighlightRegionType', [
|
|||
'METHOD_DECLARATION',
|
||||
'METHOD_DECLARATION_STATIC',
|
||||
'METHOD_STATIC',
|
||||
'MIXIN',
|
||||
'PARAMETER',
|
||||
'SETTER_DECLARATION',
|
||||
'TOP_LEVEL_VARIABLE',
|
||||
|
|
|
@ -834,6 +834,7 @@
|
|||
<code>METHOD_STATIC</code>
|
||||
<p>Deprecated - no longer sent.</p>
|
||||
</value>
|
||||
<value><code>MIXIN</code></value>
|
||||
<value>
|
||||
<code>PARAMETER</code>
|
||||
<p>Deprecated - no longer sent.</p>
|
||||
|
|
Loading…
Reference in a new issue