Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: pkg/analysis_server/test/analysis/notification_highlights_test2.dart

Issue 2484883002: Highlight FieldFormalParameterElement as a field only in declaration. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_highlights2.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.analysis.notification.highlights2; 5 library test.analysis.notification.highlights2;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 p; 904 p;
905 p = 42; 905 p = 42;
906 } 906 }
907 '''); 907 ''');
908 await prepareHighlights(); 908 await prepareHighlights();
909 assertHasRegion(HighlightRegionType.PARAMETER_DECLARATION, 'p) {'); 909 assertHasRegion(HighlightRegionType.PARAMETER_DECLARATION, 'p) {');
910 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p;'); 910 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p;');
911 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p = 42'); 911 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p = 42');
912 } 912 }
913 913
914 test_PARAMETER_named() async {
915 addTestFile('''
916 class C {
917 final int aaa;
918 C({this.aaa, int bbb});
919 }
920 main() {
921 new C(aaa: 1, bbb: 2);
922 }
923 ''');
924 await prepareHighlights();
925 assertHasRegion(HighlightRegionType.INSTANCE_FIELD_REFERENCE, 'aaa,');
926 assertHasRegion(HighlightRegionType.PARAMETER_DECLARATION, 'bbb}');
927 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'aaa: 1');
928 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'bbb: 2');
929 }
930
914 test_SETTER_DECLARATION() async { 931 test_SETTER_DECLARATION() async {
915 addTestFile(''' 932 addTestFile('''
916 set aaa(x) {} 933 set aaa(x) {}
917 class A { 934 class A {
918 set bbb(x) {} 935 set bbb(x) {}
919 static set ccc(x) {} 936 static set ccc(x) {}
920 } 937 }
921 main(A a) { 938 main(A a) {
922 aaa = 1; 939 aaa = 1;
923 a.bbb = 2; 940 a.bbb = 2;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 void test_toString() { 1101 void test_toString() {
1085 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); 1102 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS');
1086 } 1103 }
1087 1104
1088 void test_valueOf_unknown() { 1105 void test_valueOf_unknown() {
1089 expect(() { 1106 expect(() {
1090 new HighlightRegionType('no-such-type'); 1107 new HighlightRegionType('no-such-type');
1091 }, throws); 1108 }, throws);
1092 } 1109 }
1093 } 1110 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_highlights2.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698