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

Side by Side Diff: pkg/analysis_server/lib/src/computer/computer_highlights.dart

Issue 454843004: Fixes for the missing highlights. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused function Created 6 years, 4 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 | « no previous file | pkg/analysis_server/test/analysis_abstract.dart » ('j') | 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 computer.highlights; 5 library computer.highlights;
6 6
7 import 'package:analysis_services/constants.dart'; 7 import 'package:analysis_services/constants.dart';
8 import 'package:analysis_services/json.dart'; 8 import 'package:analysis_services/json.dart';
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 if (_addIdentifierRegion_localVariable(node)) { 86 if (_addIdentifierRegion_localVariable(node)) {
87 return; 87 return;
88 } 88 }
89 if (_addIdentifierRegion_method(node)) { 89 if (_addIdentifierRegion_method(node)) {
90 return; 90 return;
91 } 91 }
92 if (_addIdentifierRegion_parameter(node)) { 92 if (_addIdentifierRegion_parameter(node)) {
93 return; 93 return;
94 } 94 }
95 if (_addIdentifierRegion_topLevelVariable(node)) {
96 return;
97 }
98 if (_addIdentifierRegion_typeParameter(node)) { 95 if (_addIdentifierRegion_typeParameter(node)) {
99 return; 96 return;
100 } 97 }
101 _addRegion_node(node, HighlightType.IDENTIFIER_DEFAULT); 98 _addRegion_node(node, HighlightType.IDENTIFIER_DEFAULT);
102 } 99 }
103 100
104 void _addIdentifierRegion_annotation(Annotation node) { 101 void _addIdentifierRegion_annotation(Annotation node) {
105 ArgumentList arguments = node.arguments; 102 ArgumentList arguments = node.arguments;
106 if (arguments == null) { 103 if (arguments == null) {
107 _addRegion_node(node, HighlightType.ANNOTATION); 104 _addRegion_node(node, HighlightType.ANNOTATION);
108 } else { 105 } else {
109 _addRegion_nodeStart_tokenEnd(node, arguments.beginToken, 106 _addRegion_nodeStart_tokenEnd(
107 node,
108 arguments.beginToken,
110 HighlightType.ANNOTATION); 109 HighlightType.ANNOTATION);
111 _addRegion_token(arguments.endToken, HighlightType.ANNOTATION); 110 _addRegion_token(arguments.endToken, HighlightType.ANNOTATION);
112 } 111 }
113 } 112 }
114 113
115 bool _addIdentifierRegion_class(SimpleIdentifier node) { 114 bool _addIdentifierRegion_class(SimpleIdentifier node) {
116 Element element = node.staticElement; 115 Element element = node.staticElement;
117 if (element is! ClassElement) { 116 if (element is! ClassElement) {
118 return false; 117 return false;
119 } 118 }
(...skipping 25 matching lines...) Expand all
145 } 144 }
146 // OK 145 // OK
147 return _addRegion_node(node, HighlightType.DYNAMIC_TYPE); 146 return _addRegion_node(node, HighlightType.DYNAMIC_TYPE);
148 } 147 }
149 148
150 bool _addIdentifierRegion_field(SimpleIdentifier node) { 149 bool _addIdentifierRegion_field(SimpleIdentifier node) {
151 Element element = node.bestElement; 150 Element element = node.bestElement;
152 if (element is FieldFormalParameterElement) { 151 if (element is FieldFormalParameterElement) {
153 element = (element as FieldFormalParameterElement).field; 152 element = (element as FieldFormalParameterElement).field;
154 } 153 }
154 if (element is PropertyAccessorElement) {
155 element = (element as PropertyAccessorElement).variable;
156 }
155 if (element is FieldElement) { 157 if (element is FieldElement) {
156 if ((element as FieldElement).isStatic) { 158 if ((element as FieldElement).isStatic) {
157 return _addRegion_node(node, HighlightType.FIELD_STATIC); 159 return _addRegion_node(node, HighlightType.FIELD_STATIC);
158 } else { 160 } else {
159 return _addRegion_node(node, HighlightType.FIELD); 161 return _addRegion_node(node, HighlightType.FIELD);
160 } 162 }
161 } 163 }
162 if (element is PropertyAccessorElement) { 164 if (element is TopLevelVariableElement) {
163 if ((element as PropertyAccessorElement).isStatic) { 165 return _addRegion_node(node, HighlightType.TOP_LEVEL_VARIABLE);
164 return _addRegion_node(node, HighlightType.FIELD_STATIC);
165 } else {
166 return _addRegion_node(node, HighlightType.FIELD);
167 }
168 } 166 }
169 return false; 167 return false;
170 } 168 }
171 169
172 bool _addIdentifierRegion_function(SimpleIdentifier node) { 170 bool _addIdentifierRegion_function(SimpleIdentifier node) {
173 Element element = node.staticElement; 171 Element element = node.staticElement;
174 if (element is! FunctionElement) { 172 if (element is! FunctionElement) {
175 return false; 173 return false;
176 } 174 }
177 HighlightType type; 175 HighlightType type;
(...skipping 18 matching lines...) Expand all
196 AstNode parent = node.parent; 194 AstNode parent = node.parent;
197 if (!(parent is MethodDeclaration || parent is FunctionDeclaration)) { 195 if (!(parent is MethodDeclaration || parent is FunctionDeclaration)) {
198 return false; 196 return false;
199 } 197 }
200 // should be property accessor 198 // should be property accessor
201 Element element = node.staticElement; 199 Element element = node.staticElement;
202 if (element is! PropertyAccessorElement) { 200 if (element is! PropertyAccessorElement) {
203 return false; 201 return false;
204 } 202 }
205 // getter or setter 203 // getter or setter
206 PropertyAccessorElement propertyAccessorElement = element as 204 PropertyAccessorElement propertyAccessorElement =
207 PropertyAccessorElement; 205 element as PropertyAccessorElement;
208 if (propertyAccessorElement.isGetter) { 206 if (propertyAccessorElement.isGetter) {
209 return _addRegion_node(node, HighlightType.GETTER_DECLARATION); 207 return _addRegion_node(node, HighlightType.GETTER_DECLARATION);
210 } else { 208 } else {
211 return _addRegion_node(node, HighlightType.SETTER_DECLARATION); 209 return _addRegion_node(node, HighlightType.SETTER_DECLARATION);
212 } 210 }
213 } 211 }
214 212
215 bool _addIdentifierRegion_importPrefix(SimpleIdentifier node) { 213 bool _addIdentifierRegion_importPrefix(SimpleIdentifier node) {
216 Element element = node.staticElement; 214 Element element = node.staticElement;
217 if (element is! PrefixElement) { 215 if (element is! PrefixElement) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 267 }
270 268
271 bool _addIdentifierRegion_parameter(SimpleIdentifier node) { 269 bool _addIdentifierRegion_parameter(SimpleIdentifier node) {
272 Element element = node.staticElement; 270 Element element = node.staticElement;
273 if (element is! ParameterElement) { 271 if (element is! ParameterElement) {
274 return false; 272 return false;
275 } 273 }
276 return _addRegion_node(node, HighlightType.PARAMETER); 274 return _addRegion_node(node, HighlightType.PARAMETER);
277 } 275 }
278 276
279 bool _addIdentifierRegion_topLevelVariable(SimpleIdentifier node) {
280 Element element = node.staticElement;
281 if (element is! TopLevelVariableElement) {
282 return false;
283 }
284 return _addRegion_node(node, HighlightType.TOP_LEVEL_VARIABLE);
285 }
286
287 bool _addIdentifierRegion_typeParameter(SimpleIdentifier node) { 277 bool _addIdentifierRegion_typeParameter(SimpleIdentifier node) {
288 Element element = node.staticElement; 278 Element element = node.staticElement;
289 if (element is! TypeParameterElement) { 279 if (element is! TypeParameterElement) {
290 return false; 280 return false;
291 } 281 }
292 return _addRegion_node(node, HighlightType.TYPE_PARAMETER); 282 return _addRegion_node(node, HighlightType.TYPE_PARAMETER);
293 } 283 }
294 284
295 void _addRegion(int offset, int length, HighlightType type) { 285 void _addRegion(int offset, int length, HighlightType type) {
296 _regions.add(new HighlightRegion(offset, length, type)); 286 _regions.add(new HighlightRegion(offset, length, type));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 340 }
351 341
352 342
353 /** 343 /**
354 * Highlighting kinds constants. 344 * Highlighting kinds constants.
355 */ 345 */
356 class HighlightType { 346 class HighlightType {
357 static const HighlightType ANNOTATION = const HighlightType('ANNOTATION'); 347 static const HighlightType ANNOTATION = const HighlightType('ANNOTATION');
358 static const HighlightType BUILT_IN = const HighlightType('BUILT_IN'); 348 static const HighlightType BUILT_IN = const HighlightType('BUILT_IN');
359 static const HighlightType CLASS = const HighlightType('CLASS'); 349 static const HighlightType CLASS = const HighlightType('CLASS');
360 static const HighlightType COMMENT_BLOCK = const HighlightType( 350 static const HighlightType COMMENT_BLOCK =
361 'COMMENT_BLOCK'); 351 const HighlightType('COMMENT_BLOCK');
362 static const HighlightType COMMENT_DOCUMENTATION = const HighlightType( 352 static const HighlightType COMMENT_DOCUMENTATION =
363 'COMMENT_DOCUMENTATION'); 353 const HighlightType('COMMENT_DOCUMENTATION');
364 static const HighlightType COMMENT_END_OF_LINE = const HighlightType( 354 static const HighlightType COMMENT_END_OF_LINE =
365 'COMMENT_END_OF_LINE'); 355 const HighlightType('COMMENT_END_OF_LINE');
366 static const HighlightType CONSTRUCTOR = const HighlightType('CONSTRUCTOR'); 356 static const HighlightType CONSTRUCTOR = const HighlightType('CONSTRUCTOR');
367 static const HighlightType DIRECTIVE = const HighlightType('DIRECTIVE'); 357 static const HighlightType DIRECTIVE = const HighlightType('DIRECTIVE');
368 static const HighlightType DYNAMIC_TYPE = const HighlightType('DYNAMIC_TYPE'); 358 static const HighlightType DYNAMIC_TYPE = const HighlightType('DYNAMIC_TYPE');
369 static const HighlightType FIELD = const HighlightType('FIELD'); 359 static const HighlightType FIELD = const HighlightType('FIELD');
370 static const HighlightType FIELD_STATIC = const HighlightType('FIELD_STATIC'); 360 static const HighlightType FIELD_STATIC = const HighlightType('FIELD_STATIC');
371 static const HighlightType FUNCTION_DECLARATION = const HighlightType( 361 static const HighlightType FUNCTION_DECLARATION =
372 'FUNCTION_DECLARATION'); 362 const HighlightType('FUNCTION_DECLARATION');
373 static const HighlightType FUNCTION = const HighlightType('FUNCTION'); 363 static const HighlightType FUNCTION = const HighlightType('FUNCTION');
374 static const HighlightType FUNCTION_TYPE_ALIAS = const HighlightType( 364 static const HighlightType FUNCTION_TYPE_ALIAS =
375 'FUNCTION_TYPE_ALIAS'); 365 const HighlightType('FUNCTION_TYPE_ALIAS');
376 static const HighlightType GETTER_DECLARATION = const HighlightType( 366 static const HighlightType GETTER_DECLARATION =
377 'GETTER_DECLARATION'); 367 const HighlightType('GETTER_DECLARATION');
378 static const HighlightType KEYWORD = const HighlightType('KEYWORD'); 368 static const HighlightType KEYWORD = const HighlightType('KEYWORD');
379 static const HighlightType IDENTIFIER_DEFAULT = const HighlightType( 369 static const HighlightType IDENTIFIER_DEFAULT =
380 'IDENTIFIER_DEFAULT'); 370 const HighlightType('IDENTIFIER_DEFAULT');
381 static const HighlightType IMPORT_PREFIX = const HighlightType( 371 static const HighlightType IMPORT_PREFIX =
382 'IMPORT_PREFIX'); 372 const HighlightType('IMPORT_PREFIX');
383 static const HighlightType LITERAL_BOOLEAN = const HighlightType( 373 static const HighlightType LITERAL_BOOLEAN =
384 'LITERAL_BOOLEAN'); 374 const HighlightType('LITERAL_BOOLEAN');
385 static const HighlightType LITERAL_DOUBLE = const HighlightType( 375 static const HighlightType LITERAL_DOUBLE =
386 'LITERAL_DOUBLE'); 376 const HighlightType('LITERAL_DOUBLE');
387 static const HighlightType LITERAL_INTEGER = const HighlightType( 377 static const HighlightType LITERAL_INTEGER =
388 'LITERAL_INTEGER'); 378 const HighlightType('LITERAL_INTEGER');
389 static const HighlightType LITERAL_LIST = const HighlightType('LITERAL_LIST'); 379 static const HighlightType LITERAL_LIST = const HighlightType('LITERAL_LIST');
390 static const HighlightType LITERAL_MAP = const HighlightType('LITERAL_MAP'); 380 static const HighlightType LITERAL_MAP = const HighlightType('LITERAL_MAP');
391 static const HighlightType LITERAL_STRING = const HighlightType( 381 static const HighlightType LITERAL_STRING =
392 'LITERAL_STRING'); 382 const HighlightType('LITERAL_STRING');
393 static const HighlightType LOCAL_VARIABLE_DECLARATION = const HighlightType( 383 static const HighlightType LOCAL_VARIABLE_DECLARATION =
394 'LOCAL_VARIABLE_DECLARATION'); 384 const HighlightType('LOCAL_VARIABLE_DECLARATION');
395 static const HighlightType LOCAL_VARIABLE = const HighlightType( 385 static const HighlightType LOCAL_VARIABLE =
396 'LOCAL_VARIABLE'); 386 const HighlightType('LOCAL_VARIABLE');
397 static const HighlightType METHOD_DECLARATION = const HighlightType( 387 static const HighlightType METHOD_DECLARATION =
398 'METHOD_DECLARATION'); 388 const HighlightType('METHOD_DECLARATION');
399 static const HighlightType METHOD_DECLARATION_STATIC = const HighlightType( 389 static const HighlightType METHOD_DECLARATION_STATIC =
400 'METHOD_DECLARATION_STATIC'); 390 const HighlightType('METHOD_DECLARATION_STATIC');
401 static const HighlightType METHOD = const HighlightType('METHOD'); 391 static const HighlightType METHOD = const HighlightType('METHOD');
402 static const HighlightType METHOD_STATIC = const HighlightType( 392 static const HighlightType METHOD_STATIC =
403 'METHOD_STATIC'); 393 const HighlightType('METHOD_STATIC');
404 static const HighlightType PARAMETER = const HighlightType('PARAMETER'); 394 static const HighlightType PARAMETER = const HighlightType('PARAMETER');
405 static const HighlightType SETTER_DECLARATION = const HighlightType( 395 static const HighlightType SETTER_DECLARATION =
406 'SETTER_DECLARATION'); 396 const HighlightType('SETTER_DECLARATION');
407 static const HighlightType TOP_LEVEL_VARIABLE = const HighlightType( 397 static const HighlightType TOP_LEVEL_VARIABLE =
408 'TOP_LEVEL_VARIABLE'); 398 const HighlightType('TOP_LEVEL_VARIABLE');
409 static const HighlightType TYPE_NAME_DYNAMIC = const HighlightType( 399 static const HighlightType TYPE_NAME_DYNAMIC =
410 'TYPE_NAME_DYNAMIC'); 400 const HighlightType('TYPE_NAME_DYNAMIC');
411 static const HighlightType TYPE_PARAMETER = const HighlightType( 401 static const HighlightType TYPE_PARAMETER =
412 'TYPE_PARAMETER'); 402 const HighlightType('TYPE_PARAMETER');
413 403
414 final String name; 404 final String name;
415 405
416 const HighlightType(this.name); 406 const HighlightType(this.name);
417 407
418 @override 408 @override
419 String toString() => name; 409 String toString() => name;
420 410
421 static HighlightType valueOf(String name) { 411 static HighlightType valueOf(String name) {
422 if (ANNOTATION.name == name) return ANNOTATION; 412 if (ANNOTATION.name == name) return ANNOTATION;
(...skipping 13 matching lines...) Expand all
436 if (GETTER_DECLARATION.name == name) return GETTER_DECLARATION; 426 if (GETTER_DECLARATION.name == name) return GETTER_DECLARATION;
437 if (KEYWORD.name == name) return KEYWORD; 427 if (KEYWORD.name == name) return KEYWORD;
438 if (IDENTIFIER_DEFAULT.name == name) return IDENTIFIER_DEFAULT; 428 if (IDENTIFIER_DEFAULT.name == name) return IDENTIFIER_DEFAULT;
439 if (IMPORT_PREFIX.name == name) return IMPORT_PREFIX; 429 if (IMPORT_PREFIX.name == name) return IMPORT_PREFIX;
440 if (LITERAL_BOOLEAN.name == name) return LITERAL_BOOLEAN; 430 if (LITERAL_BOOLEAN.name == name) return LITERAL_BOOLEAN;
441 if (LITERAL_DOUBLE.name == name) return LITERAL_DOUBLE; 431 if (LITERAL_DOUBLE.name == name) return LITERAL_DOUBLE;
442 if (LITERAL_INTEGER.name == name) return LITERAL_INTEGER; 432 if (LITERAL_INTEGER.name == name) return LITERAL_INTEGER;
443 if (LITERAL_LIST.name == name) return LITERAL_LIST; 433 if (LITERAL_LIST.name == name) return LITERAL_LIST;
444 if (LITERAL_MAP.name == name) return LITERAL_MAP; 434 if (LITERAL_MAP.name == name) return LITERAL_MAP;
445 if (LITERAL_STRING.name == name) return LITERAL_STRING; 435 if (LITERAL_STRING.name == name) return LITERAL_STRING;
446 if (LOCAL_VARIABLE_DECLARATION.name == name) return 436 if (LOCAL_VARIABLE_DECLARATION.name ==
447 LOCAL_VARIABLE_DECLARATION; 437 name) return LOCAL_VARIABLE_DECLARATION;
448 if (LOCAL_VARIABLE.name == name) return LOCAL_VARIABLE; 438 if (LOCAL_VARIABLE.name == name) return LOCAL_VARIABLE;
449 if (METHOD_DECLARATION.name == name) return METHOD_DECLARATION; 439 if (METHOD_DECLARATION.name == name) return METHOD_DECLARATION;
450 if (METHOD_DECLARATION_STATIC.name == name) return 440 if (METHOD_DECLARATION_STATIC.name ==
451 METHOD_DECLARATION_STATIC; 441 name) return METHOD_DECLARATION_STATIC;
452 if (METHOD.name == name) return METHOD; 442 if (METHOD.name == name) return METHOD;
453 if (METHOD_STATIC.name == name) return METHOD_STATIC; 443 if (METHOD_STATIC.name == name) return METHOD_STATIC;
454 if (PARAMETER.name == name) return PARAMETER; 444 if (PARAMETER.name == name) return PARAMETER;
455 if (SETTER_DECLARATION.name == name) return SETTER_DECLARATION; 445 if (SETTER_DECLARATION.name == name) return SETTER_DECLARATION;
456 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE; 446 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE;
457 if (TYPE_NAME_DYNAMIC.name == name) return TYPE_NAME_DYNAMIC; 447 if (TYPE_NAME_DYNAMIC.name == name) return TYPE_NAME_DYNAMIC;
458 if (TYPE_PARAMETER.name == name) return TYPE_PARAMETER; 448 if (TYPE_PARAMETER.name == name) return TYPE_PARAMETER;
459 throw new ArgumentError('Unknown HighlightType: $name'); 449 throw new ArgumentError('Unknown HighlightType: $name');
460 } 450 }
461 } 451 }
(...skipping 13 matching lines...) Expand all
475 return super.visitAnnotation(node); 465 return super.visitAnnotation(node);
476 } 466 }
477 467
478 @override 468 @override
479 Object visitAsExpression(AsExpression node) { 469 Object visitAsExpression(AsExpression node) {
480 computer._addRegion_token(node.asOperator, HighlightType.BUILT_IN); 470 computer._addRegion_token(node.asOperator, HighlightType.BUILT_IN);
481 return super.visitAsExpression(node); 471 return super.visitAsExpression(node);
482 } 472 }
483 473
484 @override 474 @override
475 Object visitAssertStatement(AssertStatement node) {
476 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
477 return super.visitAssertStatement(node);
478 }
479
480 @override
485 Object visitBooleanLiteral(BooleanLiteral node) { 481 Object visitBooleanLiteral(BooleanLiteral node) {
482 computer._addRegion_node(node, HighlightType.KEYWORD);
486 computer._addRegion_node(node, HighlightType.LITERAL_BOOLEAN); 483 computer._addRegion_node(node, HighlightType.LITERAL_BOOLEAN);
487 return super.visitBooleanLiteral(node); 484 return super.visitBooleanLiteral(node);
488 } 485 }
489 486
490 @override 487 @override
488 Object visitBreakStatement(BreakStatement node) {
489 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
490 return super.visitBreakStatement(node);
491 }
492
493 @override
491 Object visitCatchClause(CatchClause node) { 494 Object visitCatchClause(CatchClause node) {
495 computer._addRegion_token(node.catchKeyword, HighlightType.KEYWORD);
492 computer._addRegion_token(node.onKeyword, HighlightType.BUILT_IN); 496 computer._addRegion_token(node.onKeyword, HighlightType.BUILT_IN);
493 return super.visitCatchClause(node); 497 return super.visitCatchClause(node);
494 } 498 }
495 499
496 @override 500 @override
497 Object visitClassDeclaration(ClassDeclaration node) { 501 Object visitClassDeclaration(ClassDeclaration node) {
502 computer._addRegion_token(node.classKeyword, HighlightType.KEYWORD);
498 computer._addRegion_token(node.abstractKeyword, HighlightType.BUILT_IN); 503 computer._addRegion_token(node.abstractKeyword, HighlightType.BUILT_IN);
499 return super.visitClassDeclaration(node); 504 return super.visitClassDeclaration(node);
500 } 505 }
501 506
502 @override 507 @override
503 Object visitConstructorDeclaration(ConstructorDeclaration node) { 508 Object visitConstructorDeclaration(ConstructorDeclaration node) {
504 computer._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN); 509 computer._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
505 computer._addRegion_token(node.factoryKeyword, HighlightType.BUILT_IN); 510 computer._addRegion_token(node.factoryKeyword, HighlightType.BUILT_IN);
506 return super.visitConstructorDeclaration(node); 511 return super.visitConstructorDeclaration(node);
507 } 512 }
508 513
509 @override 514 @override
515 Object visitContinueStatement(ContinueStatement node) {
516 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
517 return super.visitContinueStatement(node);
518 }
519
520 @override
521 Object visitDoStatement(DoStatement node) {
522 computer._addRegion_token(node.doKeyword, HighlightType.KEYWORD);
523 computer._addRegion_token(node.whileKeyword, HighlightType.KEYWORD);
524 return super.visitDoStatement(node);
525 }
526
527 @override
510 Object visitDoubleLiteral(DoubleLiteral node) { 528 Object visitDoubleLiteral(DoubleLiteral node) {
511 computer._addRegion_node(node, HighlightType.LITERAL_DOUBLE); 529 computer._addRegion_node(node, HighlightType.LITERAL_DOUBLE);
512 return super.visitDoubleLiteral(node); 530 return super.visitDoubleLiteral(node);
513 } 531 }
514 532
515 @override 533 @override
516 Object visitExportDirective(ExportDirective node) { 534 Object visitExportDirective(ExportDirective node) {
535 computer._addRegion_node(node, HighlightType.DIRECTIVE);
517 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 536 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
518 return super.visitExportDirective(node); 537 return super.visitExportDirective(node);
519 } 538 }
520 539
521 @override 540 @override
522 Object visitFieldDeclaration(FieldDeclaration node) { 541 Object visitFieldDeclaration(FieldDeclaration node) {
523 computer._addRegion_token(node.staticKeyword, HighlightType.BUILT_IN); 542 computer._addRegion_token(node.staticKeyword, HighlightType.BUILT_IN);
524 return super.visitFieldDeclaration(node); 543 return super.visitFieldDeclaration(node);
525 } 544 }
526 545
527 @override 546 @override
547 Object visitForEachStatement(ForEachStatement node) {
548 computer._addRegion_token(node.forKeyword, HighlightType.KEYWORD);
549 computer._addRegion_token(node.inKeyword, HighlightType.KEYWORD);
550 return super.visitForEachStatement(node);
551 }
552
553 @override
554 Object visitForStatement(ForStatement node) {
555 computer._addRegion_token(node.forKeyword, HighlightType.KEYWORD);
556 return super.visitForStatement(node);
557 }
558
559 @override
528 Object visitFunctionDeclaration(FunctionDeclaration node) { 560 Object visitFunctionDeclaration(FunctionDeclaration node) {
529 computer._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN); 561 computer._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
530 computer._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN); 562 computer._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN);
531 return super.visitFunctionDeclaration(node); 563 return super.visitFunctionDeclaration(node);
532 } 564 }
533 565
534 @override 566 @override
535 Object visitFunctionTypeAlias(FunctionTypeAlias node) { 567 Object visitFunctionTypeAlias(FunctionTypeAlias node) {
536 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 568 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
537 return super.visitFunctionTypeAlias(node); 569 return super.visitFunctionTypeAlias(node);
538 } 570 }
539 571
540 @override 572 @override
541 Object visitHideCombinator(HideCombinator node) { 573 Object visitHideCombinator(HideCombinator node) {
542 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 574 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
543 return super.visitHideCombinator(node); 575 return super.visitHideCombinator(node);
544 } 576 }
545 577
546 @override 578 @override
579 Object visitIfStatement(IfStatement node) {
580 computer._addRegion_token(node.ifKeyword, HighlightType.KEYWORD);
581 return super.visitIfStatement(node);
582 }
583
584 @override
547 Object visitImplementsClause(ImplementsClause node) { 585 Object visitImplementsClause(ImplementsClause node) {
548 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 586 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
549 return super.visitImplementsClause(node); 587 return super.visitImplementsClause(node);
550 } 588 }
551 589
552 @override 590 @override
553 Object visitImportDirective(ImportDirective node) { 591 Object visitImportDirective(ImportDirective node) {
592 computer._addRegion_node(node, HighlightType.DIRECTIVE);
554 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 593 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
555 computer._addRegion_token(node.deferredToken, HighlightType.BUILT_IN); 594 computer._addRegion_token(node.deferredToken, HighlightType.BUILT_IN);
556 computer._addRegion_token(node.asToken, HighlightType.BUILT_IN); 595 computer._addRegion_token(node.asToken, HighlightType.BUILT_IN);
557 return super.visitImportDirective(node); 596 return super.visitImportDirective(node);
558 } 597 }
559 598
560 @override 599 @override
600 Object visitInstanceCreationExpression(InstanceCreationExpression node) {
601 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
602 return super.visitInstanceCreationExpression(node);
603 }
604
605 @override
561 Object visitIntegerLiteral(IntegerLiteral node) { 606 Object visitIntegerLiteral(IntegerLiteral node) {
562 computer._addRegion_node(node, HighlightType.LITERAL_INTEGER); 607 computer._addRegion_node(node, HighlightType.LITERAL_INTEGER);
563 return super.visitIntegerLiteral(node); 608 return super.visitIntegerLiteral(node);
564 } 609 }
565 610
566 @override 611 @override
612 Object visitIsExpression(IsExpression node) {
613 computer._addRegion_token(node.isOperator, HighlightType.KEYWORD);
614 return super.visitIsExpression(node);
615 }
616
617 @override
567 Object visitLibraryDirective(LibraryDirective node) { 618 Object visitLibraryDirective(LibraryDirective node) {
619 computer._addRegion_node(node, HighlightType.DIRECTIVE);
568 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 620 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
569 return super.visitLibraryDirective(node); 621 return super.visitLibraryDirective(node);
570 } 622 }
571 623
572 @override 624 @override
625 Object visitListLiteral(ListLiteral node) {
626 computer._addRegion_node(node, HighlightType.LITERAL_LIST);
627 computer._addRegion_token(node.constKeyword, HighlightType.KEYWORD);
628 return super.visitListLiteral(node);
629 }
630
631 @override
632 Object visitMapLiteral(MapLiteral node) {
633 computer._addRegion_node(node, HighlightType.LITERAL_MAP);
634 computer._addRegion_token(node.constKeyword, HighlightType.KEYWORD);
635 return super.visitMapLiteral(node);
636 }
637
638 @override
573 Object visitMethodDeclaration(MethodDeclaration node) { 639 Object visitMethodDeclaration(MethodDeclaration node) {
574 computer._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN); 640 computer._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
575 computer._addRegion_token(node.modifierKeyword, HighlightType.BUILT_IN); 641 computer._addRegion_token(node.modifierKeyword, HighlightType.BUILT_IN);
576 computer._addRegion_token(node.operatorKeyword, HighlightType.BUILT_IN); 642 computer._addRegion_token(node.operatorKeyword, HighlightType.BUILT_IN);
577 computer._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN); 643 computer._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN);
578 return super.visitMethodDeclaration(node); 644 return super.visitMethodDeclaration(node);
579 } 645 }
580 646
581 @override 647 @override
582 Object visitNativeClause(NativeClause node) { 648 Object visitNativeClause(NativeClause node) {
583 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 649 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
584 return super.visitNativeClause(node); 650 return super.visitNativeClause(node);
585 } 651 }
586 652
587 @override 653 @override
588 Object visitNativeFunctionBody(NativeFunctionBody node) { 654 Object visitNativeFunctionBody(NativeFunctionBody node) {
589 computer._addRegion_token(node.nativeToken, HighlightType.BUILT_IN); 655 computer._addRegion_token(node.nativeToken, HighlightType.BUILT_IN);
590 return super.visitNativeFunctionBody(node); 656 return super.visitNativeFunctionBody(node);
591 } 657 }
592 658
593 @override 659 @override
594 Object visitPartDirective(PartDirective node) { 660 Object visitPartDirective(PartDirective node) {
661 computer._addRegion_node(node, HighlightType.DIRECTIVE);
595 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 662 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
596 return super.visitPartDirective(node); 663 return super.visitPartDirective(node);
597 } 664 }
598 665
599 @override 666 @override
600 Object visitPartOfDirective(PartOfDirective node) { 667 Object visitPartOfDirective(PartOfDirective node) {
601 computer._addRegion_tokenStart_tokenEnd(node.partToken, node.ofToken, 668 computer._addRegion_node(node, HighlightType.DIRECTIVE);
669 computer._addRegion_tokenStart_tokenEnd(
670 node.partToken,
671 node.ofToken,
602 HighlightType.BUILT_IN); 672 HighlightType.BUILT_IN);
603 return super.visitPartOfDirective(node); 673 return super.visitPartOfDirective(node);
604 } 674 }
605 675
606 @override 676 @override
677 Object visitRethrowExpression(RethrowExpression node) {
678 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
679 return super.visitRethrowExpression(node);
680 }
681
682 @override
683 Object visitReturnStatement(ReturnStatement node) {
684 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
685 return super.visitReturnStatement(node);
686 }
687
688 @override
607 Object visitShowCombinator(ShowCombinator node) { 689 Object visitShowCombinator(ShowCombinator node) {
608 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN); 690 computer._addRegion_token(node.keyword, HighlightType.BUILT_IN);
609 return super.visitShowCombinator(node); 691 return super.visitShowCombinator(node);
610 } 692 }
611 693
612 @override 694 @override
613 Object visitSimpleIdentifier(SimpleIdentifier node) { 695 Object visitSimpleIdentifier(SimpleIdentifier node) {
614 computer._addIdentifierRegion(node); 696 computer._addIdentifierRegion(node);
615 return super.visitSimpleIdentifier(node); 697 return super.visitSimpleIdentifier(node);
616 } 698 }
617 699
618 @override 700 @override
619 Object visitSimpleStringLiteral(SimpleStringLiteral node) { 701 Object visitSimpleStringLiteral(SimpleStringLiteral node) {
620 computer._addRegion_node(node, HighlightType.LITERAL_STRING); 702 computer._addRegion_node(node, HighlightType.LITERAL_STRING);
621 return super.visitSimpleStringLiteral(node); 703 return super.visitSimpleStringLiteral(node);
622 } 704 }
623 705
624 @override 706 @override
707 Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
708 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
709 return super.visitSuperConstructorInvocation(node);
710 }
711
712 @override
713 Object visitSwitchCase(SwitchCase node) {
714 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
715 return super.visitSwitchCase(node);
716 }
717
718 @override
719 Object visitSwitchDefault(SwitchDefault node) {
720 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
721 return super.visitSwitchDefault(node);
722 }
723
724 @override
725 Object visitSwitchStatement(SwitchStatement node) {
726 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
727 return super.visitSwitchStatement(node);
728 }
729
730 @override
731 Object visitThisExpression(ThisExpression node) {
732 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
733 return super.visitThisExpression(node);
734 }
735
736 @override
737 Object visitTryStatement(TryStatement node) {
738 computer._addRegion_token(node.tryKeyword, HighlightType.KEYWORD);
739 computer._addRegion_token(node.finallyKeyword, HighlightType.KEYWORD);
740 return super.visitTryStatement(node);
741 }
742
743 @override
625 Object visitTypeName(TypeName node) { 744 Object visitTypeName(TypeName node) {
626 DartType type = node.type; 745 DartType type = node.type;
627 if (type != null) { 746 if (type != null) {
628 if (type.isDynamic && node.name.name == "dynamic") { 747 if (type.isDynamic && node.name.name == "dynamic") {
629 computer._addRegion_node(node, HighlightType.TYPE_NAME_DYNAMIC); 748 computer._addRegion_node(node, HighlightType.TYPE_NAME_DYNAMIC);
630 return null; 749 return null;
631 } 750 }
632 } 751 }
633 return super.visitTypeName(node); 752 return super.visitTypeName(node);
634 } 753 }
754
755 @override
756 Object visitVariableDeclarationList(VariableDeclarationList node) {
757 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
758 return super.visitVariableDeclarationList(node);
759 }
760
761 @override
762 Object visitWhileStatement(WhileStatement node) {
763 computer._addRegion_token(node.keyword, HighlightType.KEYWORD);
764 return super.visitWhileStatement(node);
765 }
766
767 @override
768 Object visitWithClause(WithClause node) {
769 computer._addRegion_token(node.withKeyword, HighlightType.KEYWORD);
770 return super.visitWithClause(node);
771 }
635 } 772 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698