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

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

Issue 363723002: Change HashMap declarations back to Map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
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.element; 5 library computer.element;
6 6
7 import 'dart:collection';
8
9 import 'package:analysis_server/src/constants.dart'; 7 import 'package:analysis_server/src/constants.dart';
10 import 'package:analyzer/src/generated/element.dart' as engine; 8 import 'package:analyzer/src/generated/element.dart' as engine;
11 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; 9 import 'package:analyzer/src/generated/utilities_dart.dart' as engine;
12 10
13 11
14 /** 12 /**
15 * Information about an element. 13 * Information about an element.
16 */ 14 */
17 class Element { 15 class Element {
18 static const List<Element> EMPTY_ARRAY = const <Element>[]; 16 static const List<Element> EMPTY_ARRAY = const <Element>[];
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 int nameLength = name != null ? name.length : 0; 72 int nameLength = name != null ? name.length : 0;
75 String elementParameters = _getParametersString(element); 73 String elementParameters = _getParametersString(element);
76 String elementReturnType = _getReturnTypeString(element); 74 String elementReturnType = _getReturnTypeString(element);
77 return new Element(ElementKind.valueOfEngine(element.kind), name, 75 return new Element(ElementKind.valueOfEngine(element.kind), name,
78 element.nameOffset, nameLength, element.isPrivate, element.isDeprecated, 76 element.nameOffset, nameLength, element.isPrivate, element.isDeprecated,
79 parameters: elementParameters, returnType: elementReturnType, isAbstract : 77 parameters: elementParameters, returnType: elementReturnType, isAbstract :
80 _isAbstract(element), isConst: _isConst(element), isFinal: _isFinal(elem ent), 78 _isAbstract(element), isConst: _isConst(element), isFinal: _isFinal(elem ent),
81 isStatic: _isStatic(element)); 79 isStatic: _isStatic(element));
82 } 80 }
83 81
84 factory Element.fromJson(HashMap<String, Object> map) { 82 factory Element.fromJson(Map<String, Object> map) {
85 ElementKind kind = ElementKind.valueOf(map[KIND]); 83 ElementKind kind = ElementKind.valueOf(map[KIND]);
86 int flags = map[FLAGS]; 84 int flags = map[FLAGS];
87 return new Element(kind, map[NAME], map[OFFSET], map[LENGTH], _hasFlag( 85 return new Element(kind, map[NAME], map[OFFSET], map[LENGTH], _hasFlag(
88 flags, FLAG_PRIVATE), _hasFlag(flags, FLAG_DEPRECATED), parameters: 86 flags, FLAG_PRIVATE), _hasFlag(flags, FLAG_DEPRECATED), parameters:
89 map[PARAMETERS], returnType: map[RETURN_TYPE], isAbstract: _hasFlag(flag s, 87 map[PARAMETERS], returnType: map[RETURN_TYPE], isAbstract: _hasFlag(flag s,
90 FLAG_ABSTRACT), isConst: _hasFlag(flags, FLAG_CONST), isFinal: _hasFlag( flags, 88 FLAG_ABSTRACT), isConst: _hasFlag(flags, FLAG_CONST), isFinal: _hasFlag( flags,
91 FLAG_FINAL), isStatic: _hasFlag(flags, FLAG_STATIC)); 89 FLAG_FINAL), isStatic: _hasFlag(flags, FLAG_STATIC));
92 } 90 }
93 91
94 int get flags { 92 int get flags {
95 int flags = 0; 93 int flags = 0;
96 if (isAbstract) flags |= FLAG_ABSTRACT; 94 if (isAbstract) flags |= FLAG_ABSTRACT;
97 if (isConst) flags |= FLAG_CONST; 95 if (isConst) flags |= FLAG_CONST;
98 if (isFinal) flags |= FLAG_FINAL; 96 if (isFinal) flags |= FLAG_FINAL;
99 if (isStatic) flags |= FLAG_STATIC; 97 if (isStatic) flags |= FLAG_STATIC;
100 if (isPrivate) flags |= FLAG_PRIVATE; 98 if (isPrivate) flags |= FLAG_PRIVATE;
101 if (isDeprecated) flags |= FLAG_DEPRECATED; 99 if (isDeprecated) flags |= FLAG_DEPRECATED;
102 return flags; 100 return flags;
103 } 101 }
104 102
105 HashMap<String, Object> toJson() { 103 Map<String, Object> toJson() {
106 HashMap<String, Object> json = { 104 Map<String, Object> json = {
107 KIND: kind.name, 105 KIND: kind.name,
108 NAME: name, 106 NAME: name,
109 OFFSET: offset, 107 OFFSET: offset,
110 LENGTH: length, 108 LENGTH: length,
111 FLAGS: flags 109 FLAGS: flags
112 }; 110 };
113 if (parameters != null) { 111 if (parameters != null) {
114 json[PARAMETERS] = parameters; 112 json[PARAMETERS] = parameters;
115 } 113 }
116 if (returnType != null) { 114 if (returnType != null) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 277 }
280 if (kind == engine.ElementKind.SETTER) { 278 if (kind == engine.ElementKind.SETTER) {
281 return SETTER; 279 return SETTER;
282 } 280 }
283 if (kind == engine.ElementKind.TOP_LEVEL_VARIABLE) { 281 if (kind == engine.ElementKind.TOP_LEVEL_VARIABLE) {
284 return TOP_LEVEL_VARIABLE; 282 return TOP_LEVEL_VARIABLE;
285 } 283 }
286 return UNKNOWN; 284 return UNKNOWN;
287 } 285 }
288 } 286 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_outline.dart ('k') | pkg/analysis_server/lib/src/context_directory_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698