| OLD | NEW |
| 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 'dart:collection'; |
| 8 |
| 7 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 11 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 12 import 'package:analyzer/src/generated/scanner.dart'; |
| 11 | 13 |
| 12 | 14 |
| 13 /** | 15 /** |
| 14 * A computer for [HighlightRegion]s in a Dart [CompilationUnit]. | 16 * A computer for [HighlightRegion]s in a Dart [CompilationUnit]. |
| 15 */ | 17 */ |
| 16 class DartUnitHighlightsComputer { | 18 class DartUnitHighlightsComputer { |
| 17 final CompilationUnit _unit; | 19 final CompilationUnit _unit; |
| 18 | 20 |
| 19 final List<Map<String, Object>> _regions = <Map<String, Object>>[]; | 21 final List<HashMap<String, Object>> _regions = <HashMap<String, Object>>[]; |
| 20 | 22 |
| 21 DartUnitHighlightsComputer(this._unit); | 23 DartUnitHighlightsComputer(this._unit); |
| 22 | 24 |
| 23 /** | 25 /** |
| 24 * Returns the computed highlight regions, not `null`. | 26 * Returns the computed highlight regions, not `null`. |
| 25 */ | 27 */ |
| 26 List<Map<String, Object>> compute() { | 28 List<HashMap<String, Object>> compute() { |
| 27 _unit.accept(new _DartUnitHighlightsComputerVisitor(this)); | 29 _unit.accept(new _DartUnitHighlightsComputerVisitor(this)); |
| 28 return _regions; | 30 return _regions; |
| 29 } | 31 } |
| 30 | 32 |
| 31 void _addIdentifierRegion(SimpleIdentifier node) { | 33 void _addIdentifierRegion(SimpleIdentifier node) { |
| 32 if (_addIdentifierRegion_keyword(node)) { | 34 if (_addIdentifierRegion_keyword(node)) { |
| 33 return; | 35 return; |
| 34 } | 36 } |
| 35 if (_addIdentifierRegion_class(node)) { | 37 if (_addIdentifierRegion_class(node)) { |
| 36 return; | 38 return; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 static const HighlightType PARAMETER = const HighlightType('PARAMETER'); | 508 static const HighlightType PARAMETER = const HighlightType('PARAMETER'); |
| 507 static const HighlightType SETTER_DECLARATION = const HighlightType('SETTER_DE
CLARATION'); | 509 static const HighlightType SETTER_DECLARATION = const HighlightType('SETTER_DE
CLARATION'); |
| 508 static const HighlightType TOP_LEVEL_VARIABLE = const HighlightType('TOP_LEVEL
_VARIABLE'); | 510 static const HighlightType TOP_LEVEL_VARIABLE = const HighlightType('TOP_LEVEL
_VARIABLE'); |
| 509 static const HighlightType TYPE_NAME_DYNAMIC = const HighlightType('TYPE_NAME_
DYNAMIC'); | 511 static const HighlightType TYPE_NAME_DYNAMIC = const HighlightType('TYPE_NAME_
DYNAMIC'); |
| 510 static const HighlightType TYPE_PARAMETER = const HighlightType('TYPE_PARAMETE
R'); | 512 static const HighlightType TYPE_PARAMETER = const HighlightType('TYPE_PARAMETE
R'); |
| 511 | 513 |
| 512 final String name; | 514 final String name; |
| 513 | 515 |
| 514 const HighlightType(this.name); | 516 const HighlightType(this.name); |
| 515 } | 517 } |
| OLD | NEW |