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

Side by Side Diff: pkg/analysis_server/test/analysis_notification_outline_test.dart

Issue 311053005: Updates for the Outline API and use it in Editor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/constants.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.domain.analysis.notification.outline; 5 library test.domain.analysis.notification.outline;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 9
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 _Outline unitOutline = outline; 65 _Outline unitOutline = outline;
66 List<_Outline> topOutlines = unitOutline.children; 66 List<_Outline> topOutlines = unitOutline.children;
67 expect(topOutlines, hasLength(2)); 67 expect(topOutlines, hasLength(2));
68 // A 68 // A
69 { 69 {
70 _Outline outline_A = topOutlines[0]; 70 _Outline outline_A = topOutlines[0];
71 expect(outline_A.kind, _OutlineKind.CLASS); 71 expect(outline_A.kind, _OutlineKind.CLASS);
72 expect(outline_A.name, "A"); 72 expect(outline_A.name, "A");
73 expect(outline_A.nameOffset, testCode.indexOf("A {")); 73 expect(outline_A.nameOffset, testCode.indexOf("A {"));
74 expect(outline_A.nameLength, 1); 74 expect(outline_A.nameLength, 1);
75 expect(outline_A.arguments, null); 75 expect(outline_A.parameters, null);
76 expect(outline_A.returnType, null); 76 expect(outline_A.returnType, null);
77 // A children 77 // A children
78 List<_Outline> outlines_A = outline_A.children; 78 List<_Outline> outlines_A = outline_A.children;
79 expect(outlines_A, hasLength(10)); 79 expect(outlines_A, hasLength(10));
80 { 80 {
81 _Outline outline = outlines_A[0]; 81 _Outline outline = outlines_A[0];
82 expect(outline.kind, _OutlineKind.FIELD); 82 expect(outline.kind, _OutlineKind.FIELD);
83 expect(outline.name, "fa"); 83 expect(outline.name, "fa");
84 expect(outline.arguments, isNull); 84 expect(outline.parameters, isNull);
85 expect(outline.returnType, "int"); 85 expect(outline.returnType, "int");
86 } 86 }
87 { 87 {
88 _Outline outline = outlines_A[1]; 88 _Outline outline = outlines_A[1];
89 expect(outline.kind, _OutlineKind.FIELD); 89 expect(outline.kind, _OutlineKind.FIELD);
90 expect(outline.name, "fb"); 90 expect(outline.name, "fb");
91 expect(outline.arguments, isNull); 91 expect(outline.parameters, isNull);
92 expect(outline.returnType, "int"); 92 expect(outline.returnType, "int");
93 } 93 }
94 { 94 {
95 _Outline outline = outlines_A[2]; 95 _Outline outline = outlines_A[2];
96 expect(outline.kind, _OutlineKind.FIELD); 96 expect(outline.kind, _OutlineKind.FIELD);
97 expect(outline.name, "fc"); 97 expect(outline.name, "fc");
98 expect(outline.arguments, isNull); 98 expect(outline.parameters, isNull);
99 expect(outline.returnType, "String"); 99 expect(outline.returnType, "String");
100 } 100 }
101 { 101 {
102 _Outline outline = outlines_A[3]; 102 _Outline outline = outlines_A[3];
103 expect(outline.kind, _OutlineKind.CONSTRUCTOR); 103 expect(outline.kind, _OutlineKind.CONSTRUCTOR);
104 expect(outline.name, "A"); 104 expect(outline.name, "A");
105 expect(outline.nameOffset, testCode.indexOf("A(int i, String s);")); 105 expect(outline.nameOffset, testCode.indexOf("A(int i, String s);"));
106 expect(outline.nameLength, "A".length); 106 expect(outline.nameLength, "A".length);
107 expect(outline.arguments, "(int i, String s)"); 107 expect(outline.parameters, "(int i, String s)");
108 expect(outline.returnType, isNull); 108 expect(outline.returnType, isNull);
109 expect(outline.isAbstract, isFalse); 109 expect(outline.isAbstract, isFalse);
110 expect(outline.isStatic, isFalse); 110 expect(outline.isStatic, isFalse);
111 } 111 }
112 { 112 {
113 _Outline outline = outlines_A[4]; 113 _Outline outline = outlines_A[4];
114 expect(outline.kind, _OutlineKind.CONSTRUCTOR); 114 expect(outline.kind, _OutlineKind.CONSTRUCTOR);
115 expect(outline.name, "A.name"); 115 expect(outline.name, "A.name");
116 expect(outline.nameOffset, testCode.indexOf("name(num p);")); 116 expect(outline.nameOffset, testCode.indexOf("name(num p);"));
117 expect(outline.nameLength, "name".length); 117 expect(outline.nameLength, "name".length);
118 expect(outline.arguments, "(num p)"); 118 expect(outline.parameters, "(num p)");
119 expect(outline.returnType, isNull); 119 expect(outline.returnType, isNull);
120 expect(outline.isAbstract, isFalse); 120 expect(outline.isAbstract, isFalse);
121 expect(outline.isStatic, isFalse); 121 expect(outline.isStatic, isFalse);
122 } 122 }
123 { 123 {
124 _Outline outline = outlines_A[5]; 124 _Outline outline = outlines_A[5];
125 expect(outline.kind, _OutlineKind.CONSTRUCTOR); 125 expect(outline.kind, _OutlineKind.CONSTRUCTOR);
126 expect(outline.name, "A._privateName"); 126 expect(outline.name, "A._privateName");
127 expect(outline.nameOffset, testCode.indexOf("_privateName(num p);")); 127 expect(outline.nameOffset, testCode.indexOf("_privateName(num p);"));
128 expect(outline.nameLength, "_privateName".length); 128 expect(outline.nameLength, "_privateName".length);
129 expect(outline.arguments, "(num p)"); 129 expect(outline.parameters, "(num p)");
130 expect(outline.returnType, isNull); 130 expect(outline.returnType, isNull);
131 expect(outline.isAbstract, isFalse); 131 expect(outline.isAbstract, isFalse);
132 expect(outline.isStatic, isFalse); 132 expect(outline.isStatic, isFalse);
133 } 133 }
134 { 134 {
135 _Outline outline = outlines_A[6]; 135 _Outline outline = outlines_A[6];
136 expect(outline.kind, _OutlineKind.METHOD); 136 expect(outline.kind, _OutlineKind.METHOD);
137 expect(outline.name, "ma"); 137 expect(outline.name, "ma");
138 expect(outline.nameOffset, testCode.indexOf("ma(int pa) => null;")); 138 expect(outline.nameOffset, testCode.indexOf("ma(int pa) => null;"));
139 expect(outline.nameLength, "ma".length); 139 expect(outline.nameLength, "ma".length);
140 expect(outline.arguments, "(int pa)"); 140 expect(outline.parameters, "(int pa)");
141 expect(outline.returnType, "String"); 141 expect(outline.returnType, "String");
142 expect(outline.isAbstract, isFalse); 142 expect(outline.isAbstract, isFalse);
143 expect(outline.isStatic, isTrue); 143 expect(outline.isStatic, isTrue);
144 } 144 }
145 { 145 {
146 _Outline outline = outlines_A[7]; 146 _Outline outline = outlines_A[7];
147 expect(outline.kind, _OutlineKind.METHOD); 147 expect(outline.kind, _OutlineKind.METHOD);
148 expect(outline.name, "_mb"); 148 expect(outline.name, "_mb");
149 expect(outline.nameOffset, testCode.indexOf("_mb(int pb);")); 149 expect(outline.nameOffset, testCode.indexOf("_mb(int pb);"));
150 expect(outline.nameLength, "_mb".length); 150 expect(outline.nameLength, "_mb".length);
151 expect(outline.arguments, "(int pb)"); 151 expect(outline.parameters, "(int pb)");
152 expect(outline.returnType, ""); 152 expect(outline.returnType, "");
153 expect(outline.isAbstract, isTrue); 153 expect(outline.isAbstract, isTrue);
154 expect(outline.isStatic, isFalse); 154 expect(outline.isStatic, isFalse);
155 } 155 }
156 { 156 {
157 _Outline outline = outlines_A[8]; 157 _Outline outline = outlines_A[8];
158 expect(outline.kind, _OutlineKind.GETTER); 158 expect(outline.kind, _OutlineKind.GETTER);
159 expect(outline.name, "propA"); 159 expect(outline.name, "propA");
160 expect(outline.nameOffset, testCode.indexOf("propA => null;")); 160 expect(outline.nameOffset, testCode.indexOf("propA => null;"));
161 expect(outline.nameLength, "propA".length); 161 expect(outline.nameLength, "propA".length);
162 expect(outline.arguments, ""); 162 expect(outline.parameters, "");
163 expect(outline.returnType, "String"); 163 expect(outline.returnType, "String");
164 } 164 }
165 { 165 {
166 _Outline outline = outlines_A[9]; 166 _Outline outline = outlines_A[9];
167 expect(outline.kind, _OutlineKind.SETTER); 167 expect(outline.kind, _OutlineKind.SETTER);
168 expect(outline.name, "propB"); 168 expect(outline.name, "propB");
169 expect(outline.nameOffset, testCode.indexOf("propB(int v) {}")); 169 expect(outline.nameOffset, testCode.indexOf("propB(int v) {}"));
170 expect(outline.nameLength, "propB".length); 170 expect(outline.nameLength, "propB".length);
171 expect(outline.arguments, "(int v)"); 171 expect(outline.parameters, "(int v)");
172 expect(outline.returnType, ""); 172 expect(outline.returnType, "");
173 } 173 }
174 } 174 }
175 // B 175 // B
176 { 176 {
177 _Outline outline_B = topOutlines[1]; 177 _Outline outline_B = topOutlines[1];
178 expect(outline_B.kind, _OutlineKind.CLASS); 178 expect(outline_B.kind, _OutlineKind.CLASS);
179 expect(outline_B.name, "B"); 179 expect(outline_B.name, "B");
180 expect(outline_B.nameOffset, testCode.indexOf("B {")); 180 expect(outline_B.nameOffset, testCode.indexOf("B {"));
181 expect(outline_B.nameLength, 1); 181 expect(outline_B.nameLength, 1);
182 expect(outline_B.arguments, null); 182 expect(outline_B.parameters, null);
183 expect(outline_B.returnType, null); 183 expect(outline_B.returnType, null);
184 // B children 184 // B children
185 List<_Outline> outlines_B = outline_B.children; 185 List<_Outline> outlines_B = outline_B.children;
186 expect(outlines_B, hasLength(1)); 186 expect(outlines_B, hasLength(1));
187 { 187 {
188 _Outline outline = outlines_B[0]; 188 _Outline outline = outlines_B[0];
189 expect(outline.kind, _OutlineKind.CONSTRUCTOR); 189 expect(outline.kind, _OutlineKind.CONSTRUCTOR);
190 expect(outline.name, "B"); 190 expect(outline.name, "B");
191 expect(outline.nameOffset, testCode.indexOf("B(int p);")); 191 expect(outline.nameOffset, testCode.indexOf("B(int p);"));
192 expect(outline.nameLength, "B".length); 192 expect(outline.nameLength, "B".length);
193 expect(outline.arguments, "(int p)"); 193 expect(outline.parameters, "(int p)");
194 expect(outline.returnType, isNull); 194 expect(outline.returnType, isNull);
195 } 195 }
196 } 196 }
197 }); 197 });
198 } 198 }
199 199
200 test_sourceRange_inClass() { 200 test_sourceRange_inClass() {
201 addTestFile(''' 201 addTestFile('''
202 class A { // leftA 202 class A { // leftA
203 int methodA() {} // endA 203 int methodA() {} // endA
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 _Outline unitOutline = outline; 416 _Outline unitOutline = outline;
417 List<_Outline> topOutlines = unitOutline.children; 417 List<_Outline> topOutlines = unitOutline.children;
418 expect(topOutlines, hasLength(2)); 418 expect(topOutlines, hasLength(2));
419 // A 419 // A
420 { 420 {
421 _Outline outline_A = topOutlines[0]; 421 _Outline outline_A = topOutlines[0];
422 expect(outline_A.kind, _OutlineKind.CLASS); 422 expect(outline_A.kind, _OutlineKind.CLASS);
423 expect(outline_A.name, "A"); 423 expect(outline_A.name, "A");
424 expect(outline_A.nameOffset, testCode.indexOf("A {")); 424 expect(outline_A.nameOffset, testCode.indexOf("A {"));
425 expect(outline_A.nameLength, "A".length); 425 expect(outline_A.nameLength, "A".length);
426 expect(outline_A.arguments, null); 426 expect(outline_A.parameters, null);
427 expect(outline_A.returnType, null); 427 expect(outline_A.returnType, null);
428 // A children 428 // A children
429 List<_Outline> outlines_A = outline_A.children; 429 List<_Outline> outlines_A = outline_A.children;
430 expect(outlines_A, hasLength(2)); 430 expect(outlines_A, hasLength(2));
431 { 431 {
432 _Outline constructorOutline = outlines_A[0]; 432 _Outline constructorOutline = outlines_A[0];
433 expect(constructorOutline.kind, _OutlineKind.CONSTRUCTOR); 433 expect(constructorOutline.kind, _OutlineKind.CONSTRUCTOR);
434 expect(constructorOutline.name, "A"); 434 expect(constructorOutline.name, "A");
435 expect(constructorOutline.nameOffset, testCode.indexOf("A() {")); 435 expect(constructorOutline.nameOffset, testCode.indexOf("A() {"));
436 expect(constructorOutline.nameLength, "A".length); 436 expect(constructorOutline.nameLength, "A".length);
437 expect(constructorOutline.arguments, "()"); 437 expect(constructorOutline.parameters, "()");
438 expect(constructorOutline.returnType, isNull); 438 expect(constructorOutline.returnType, isNull);
439 // local function 439 // local function
440 List<_Outline> outlines_constructor = constructorOutline.children; 440 List<_Outline> outlines_constructor = constructorOutline.children;
441 expect(outlines_constructor, hasLength(1)); 441 expect(outlines_constructor, hasLength(1));
442 { 442 {
443 _Outline outline = outlines_constructor[0]; 443 _Outline outline = outlines_constructor[0];
444 expect(outline.kind, _OutlineKind.FUNCTION); 444 expect(outline.kind, _OutlineKind.FUNCTION);
445 expect(outline.name, "local_A"); 445 expect(outline.name, "local_A");
446 expect(outline.nameOffset, testCode.indexOf("local_A() {}")); 446 expect(outline.nameOffset, testCode.indexOf("local_A() {}"));
447 expect(outline.nameLength, "local_A".length); 447 expect(outline.nameLength, "local_A".length);
448 expect(outline.arguments, "()"); 448 expect(outline.parameters, "()");
449 expect(outline.returnType, "int"); 449 expect(outline.returnType, "int");
450 } 450 }
451 } 451 }
452 { 452 {
453 _Outline outline_m = outlines_A[1]; 453 _Outline outline_m = outlines_A[1];
454 expect(outline_m.kind, _OutlineKind.METHOD); 454 expect(outline_m.kind, _OutlineKind.METHOD);
455 expect(outline_m.name, "m"); 455 expect(outline_m.name, "m");
456 expect(outline_m.nameOffset, testCode.indexOf("m() {")); 456 expect(outline_m.nameOffset, testCode.indexOf("m() {"));
457 expect(outline_m.nameLength, "m".length); 457 expect(outline_m.nameLength, "m".length);
458 expect(outline_m.arguments, "()"); 458 expect(outline_m.parameters, "()");
459 expect(outline_m.returnType, ""); 459 expect(outline_m.returnType, "");
460 // local function 460 // local function
461 List<_Outline> methodChildren = outline_m.children; 461 List<_Outline> methodChildren = outline_m.children;
462 expect(methodChildren, hasLength(1)); 462 expect(methodChildren, hasLength(1));
463 { 463 {
464 _Outline outline = methodChildren[0]; 464 _Outline outline = methodChildren[0];
465 expect(outline.kind, _OutlineKind.FUNCTION); 465 expect(outline.kind, _OutlineKind.FUNCTION);
466 expect(outline.name, "local_m"); 466 expect(outline.name, "local_m");
467 expect(outline.nameOffset, testCode.indexOf("local_m() {}")); 467 expect(outline.nameOffset, testCode.indexOf("local_m() {}"));
468 expect(outline.nameLength, "local_m".length); 468 expect(outline.nameLength, "local_m".length);
469 expect(outline.arguments, "()"); 469 expect(outline.parameters, "()");
470 expect(outline.returnType, ""); 470 expect(outline.returnType, "");
471 } 471 }
472 } 472 }
473 } 473 }
474 // f() 474 // f()
475 { 475 {
476 _Outline outline_f = topOutlines[1]; 476 _Outline outline_f = topOutlines[1];
477 expect(outline_f.kind, _OutlineKind.FUNCTION); 477 expect(outline_f.kind, _OutlineKind.FUNCTION);
478 expect(outline_f.name, "f"); 478 expect(outline_f.name, "f");
479 expect(outline_f.nameOffset, testCode.indexOf("f() {")); 479 expect(outline_f.nameOffset, testCode.indexOf("f() {"));
480 expect(outline_f.nameLength, "f".length); 480 expect(outline_f.nameLength, "f".length);
481 expect(outline_f.arguments, "()"); 481 expect(outline_f.parameters, "()");
482 expect(outline_f.returnType, ""); 482 expect(outline_f.returnType, "");
483 // f() children 483 // f() children
484 List<_Outline> outlines_f = outline_f.children; 484 List<_Outline> outlines_f = outline_f.children;
485 expect(outlines_f, hasLength(2)); 485 expect(outlines_f, hasLength(2));
486 { 486 {
487 _Outline outline_f1 = outlines_f[0]; 487 _Outline outline_f1 = outlines_f[0];
488 expect(outline_f1.kind, _OutlineKind.FUNCTION); 488 expect(outline_f1.kind, _OutlineKind.FUNCTION);
489 expect(outline_f1.name, "local_f1"); 489 expect(outline_f1.name, "local_f1");
490 expect(outline_f1.nameOffset, testCode.indexOf("local_f1(int i) {}")); 490 expect(outline_f1.nameOffset, testCode.indexOf("local_f1(int i) {}"));
491 expect(outline_f1.nameLength, "local_f1".length); 491 expect(outline_f1.nameLength, "local_f1".length);
492 expect(outline_f1.arguments, "(int i)"); 492 expect(outline_f1.parameters, "(int i)");
493 expect(outline_f1.returnType, ""); 493 expect(outline_f1.returnType, "");
494 } 494 }
495 { 495 {
496 _Outline outline_f2 = outlines_f[1]; 496 _Outline outline_f2 = outlines_f[1];
497 expect(outline_f2.kind, _OutlineKind.FUNCTION); 497 expect(outline_f2.kind, _OutlineKind.FUNCTION);
498 expect(outline_f2.name, "local_f2"); 498 expect(outline_f2.name, "local_f2");
499 expect(outline_f2.nameOffset, testCode.indexOf("local_f2(String s) {") ); 499 expect(outline_f2.nameOffset, testCode.indexOf("local_f2(String s) {") );
500 expect(outline_f2.nameLength, "local_f2".length); 500 expect(outline_f2.nameLength, "local_f2".length);
501 expect(outline_f2.arguments, "(String s)"); 501 expect(outline_f2.parameters, "(String s)");
502 expect(outline_f2.returnType, ""); 502 expect(outline_f2.returnType, "");
503 // local_f2() local function 503 // local_f2() local function
504 List<_Outline> outlines_f2 = outline_f2.children; 504 List<_Outline> outlines_f2 = outline_f2.children;
505 expect(outlines_f2, hasLength(1)); 505 expect(outlines_f2, hasLength(1));
506 { 506 {
507 _Outline outline_f21 = outlines_f2[0]; 507 _Outline outline_f21 = outlines_f2[0];
508 expect(outline_f21.kind, _OutlineKind.FUNCTION); 508 expect(outline_f21.kind, _OutlineKind.FUNCTION);
509 expect(outline_f21.name, "local_f21"); 509 expect(outline_f21.name, "local_f21");
510 expect(outline_f21.nameOffset, testCode.indexOf("local_f21(int p) {" )); 510 expect(outline_f21.nameOffset, testCode.indexOf("local_f21(int p) {" ));
511 expect(outline_f21.nameLength, "local_f21".length); 511 expect(outline_f21.nameLength, "local_f21".length);
512 expect(outline_f21.arguments, "(int p)"); 512 expect(outline_f21.parameters, "(int p)");
513 expect(outline_f21.returnType, ""); 513 expect(outline_f21.returnType, "");
514 } 514 }
515 } 515 }
516 } 516 }
517 }); 517 });
518 } 518 }
519 519
520 test_topLevel() { 520 test_topLevel() {
521 addTestFile(''' 521 addTestFile('''
522 typedef String FTA(int i, String s); 522 typedef String FTA(int i, String s);
(...skipping 10 matching lines...) Expand all
533 _Outline unitOutline = outline; 533 _Outline unitOutline = outline;
534 List<_Outline> topOutlines = unitOutline.children; 534 List<_Outline> topOutlines = unitOutline.children;
535 expect(topOutlines, hasLength(9)); 535 expect(topOutlines, hasLength(9));
536 // FTA 536 // FTA
537 { 537 {
538 _Outline outline = topOutlines[0]; 538 _Outline outline = topOutlines[0];
539 expect(outline.kind, _OutlineKind.FUNCTION_TYPE_ALIAS); 539 expect(outline.kind, _OutlineKind.FUNCTION_TYPE_ALIAS);
540 expect(outline.name, "FTA"); 540 expect(outline.name, "FTA");
541 expect(outline.nameOffset, testCode.indexOf("FTA(")); 541 expect(outline.nameOffset, testCode.indexOf("FTA("));
542 expect(outline.nameLength, "FTA".length); 542 expect(outline.nameLength, "FTA".length);
543 expect(outline.arguments, "(int i, String s)"); 543 expect(outline.parameters, "(int i, String s)");
544 expect(outline.returnType, "String"); 544 expect(outline.returnType, "String");
545 } 545 }
546 // FTB 546 // FTB
547 { 547 {
548 _Outline outline = topOutlines[1]; 548 _Outline outline = topOutlines[1];
549 expect(outline.kind, _OutlineKind.FUNCTION_TYPE_ALIAS); 549 expect(outline.kind, _OutlineKind.FUNCTION_TYPE_ALIAS);
550 expect(outline.name, "FTB"); 550 expect(outline.name, "FTB");
551 expect(outline.nameOffset, testCode.indexOf("FTB(")); 551 expect(outline.nameOffset, testCode.indexOf("FTB("));
552 expect(outline.nameLength, "FTB".length); 552 expect(outline.nameLength, "FTB".length);
553 expect(outline.arguments, "(int p)"); 553 expect(outline.parameters, "(int p)");
554 expect(outline.returnType, ""); 554 expect(outline.returnType, "");
555 } 555 }
556 // CTA 556 // CTA
557 { 557 {
558 _Outline outline = topOutlines[4]; 558 _Outline outline = topOutlines[4];
559 expect(outline.kind, _OutlineKind.CLASS_TYPE_ALIAS); 559 expect(outline.kind, _OutlineKind.CLASS_TYPE_ALIAS);
560 expect(outline.name, "CTA"); 560 expect(outline.name, "CTA");
561 expect(outline.nameOffset, testCode.indexOf("CTA =")); 561 expect(outline.nameOffset, testCode.indexOf("CTA ="));
562 expect(outline.nameLength, "CTA".length); 562 expect(outline.nameLength, "CTA".length);
563 expect(outline.arguments, isNull); 563 expect(outline.parameters, isNull);
564 expect(outline.returnType, isNull); 564 expect(outline.returnType, isNull);
565 } 565 }
566 // fA 566 // fA
567 { 567 {
568 _Outline outline = topOutlines[5]; 568 _Outline outline = topOutlines[5];
569 expect(outline.kind, _OutlineKind.FUNCTION); 569 expect(outline.kind, _OutlineKind.FUNCTION);
570 expect(outline.name, "fA"); 570 expect(outline.name, "fA");
571 expect(outline.nameOffset, testCode.indexOf("fA(")); 571 expect(outline.nameOffset, testCode.indexOf("fA("));
572 expect(outline.nameLength, "fA".length); 572 expect(outline.nameLength, "fA".length);
573 expect(outline.arguments, "(int i, String s)"); 573 expect(outline.parameters, "(int i, String s)");
574 expect(outline.returnType, "String"); 574 expect(outline.returnType, "String");
575 } 575 }
576 // fB 576 // fB
577 { 577 {
578 _Outline outline = topOutlines[6]; 578 _Outline outline = topOutlines[6];
579 expect(outline.kind, _OutlineKind.FUNCTION); 579 expect(outline.kind, _OutlineKind.FUNCTION);
580 expect(outline.name, "fB"); 580 expect(outline.name, "fB");
581 expect(outline.nameOffset, testCode.indexOf("fB(")); 581 expect(outline.nameOffset, testCode.indexOf("fB("));
582 expect(outline.nameLength, "fB".length); 582 expect(outline.nameLength, "fB".length);
583 expect(outline.arguments, "(int p)"); 583 expect(outline.parameters, "(int p)");
584 expect(outline.returnType, ""); 584 expect(outline.returnType, "");
585 } 585 }
586 // propA 586 // propA
587 { 587 {
588 _Outline outline = topOutlines[7]; 588 _Outline outline = topOutlines[7];
589 expect(outline.kind, _OutlineKind.GETTER); 589 expect(outline.kind, _OutlineKind.GETTER);
590 expect(outline.name, "propA"); 590 expect(outline.name, "propA");
591 expect(outline.nameOffset, testCode.indexOf("propA => null;")); 591 expect(outline.nameOffset, testCode.indexOf("propA => null;"));
592 expect(outline.nameLength, "propA".length); 592 expect(outline.nameLength, "propA".length);
593 expect(outline.arguments, ""); 593 expect(outline.parameters, "");
594 expect(outline.returnType, "String"); 594 expect(outline.returnType, "String");
595 } 595 }
596 // propB 596 // propB
597 { 597 {
598 _Outline outline = topOutlines[8]; 598 _Outline outline = topOutlines[8];
599 expect(outline.kind, _OutlineKind.SETTER); 599 expect(outline.kind, _OutlineKind.SETTER);
600 expect(outline.name, "propB"); 600 expect(outline.name, "propB");
601 expect(outline.nameOffset, testCode.indexOf("propB(int v) {}")); 601 expect(outline.nameOffset, testCode.indexOf("propB(int v) {}"));
602 expect(outline.nameLength, "propB".length); 602 expect(outline.nameLength, "propB".length);
603 expect(outline.arguments, "(int v)"); 603 expect(outline.parameters, "(int v)");
604 expect(outline.returnType, ""); 604 expect(outline.returnType, "");
605 } 605 }
606 }); 606 });
607 } 607 }
608 } 608 }
609 609
610 610
611 /** 611 /**
612 * Element outline kinds. 612 * Element outline kinds.
613 */ 613 */
(...skipping 30 matching lines...) Expand all
644 644
645 _Outline parent; 645 _Outline parent;
646 final _OutlineKind kind; 646 final _OutlineKind kind;
647 final String name; 647 final String name;
648 final int nameOffset; 648 final int nameOffset;
649 final int nameLength; 649 final int nameLength;
650 final int elementOffset; 650 final int elementOffset;
651 final int elementLength; 651 final int elementLength;
652 final bool isAbstract; 652 final bool isAbstract;
653 final bool isStatic; 653 final bool isStatic;
654 final String arguments; 654 final String parameters;
655 final String returnType; 655 final String returnType;
656 final List<_Outline> children = <_Outline>[]; 656 final List<_Outline> children = <_Outline>[];
657 657
658 _Outline(this.kind, this.name, 658 _Outline(this.kind, this.name,
659 this.nameOffset, this.nameLength, 659 this.nameOffset, this.nameLength,
660 this.elementOffset, this.elementLength, 660 this.elementOffset, this.elementLength,
661 this.isAbstract, this.isStatic, 661 this.isAbstract, this.isStatic,
662 this.arguments, this.returnType); 662 this.parameters, this.returnType);
663 663
664 factory _Outline.fromJson(Map<String, Object> map) { 664 factory _Outline.fromJson(Map<String, Object> map) {
665 _Outline outline = new _Outline( 665 _Outline outline = new _Outline(
666 _OutlineKind.valueOf(map[KIND]), map[NAME], 666 _OutlineKind.valueOf(map[KIND]), map[NAME],
667 map[NAME_OFFSET], map[NAME_LENGTH], 667 map[NAME_OFFSET], map[NAME_LENGTH],
668 map[ELEMENT_OFFSET], map[ELEMENT_LENGTH], 668 map[ELEMENT_OFFSET], map[ELEMENT_LENGTH],
669 map[IS_ABSTRACT], map[IS_STATIC], 669 map[IS_ABSTRACT], map[IS_STATIC],
670 map[ARGUMENTS], map[RETURN_TYPE]); 670 map[PARAMETERS], map[RETURN_TYPE]);
671 List<Map<String, Object>> childrenMaps = map[CHILDREN]; 671 List<Map<String, Object>> childrenMaps = map[CHILDREN];
672 if (childrenMaps != null) { 672 if (childrenMaps != null) {
673 childrenMaps.forEach((childMap) { 673 childrenMaps.forEach((childMap) {
674 outline.children.add(new _Outline.fromJson(childMap)); 674 outline.children.add(new _Outline.fromJson(childMap));
675 }); 675 });
676 } 676 }
677 return outline; 677 return outline;
678 } 678 }
679 } 679 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/constants.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698