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

Side by Side Diff: pkg/analysis_server/lib/src/generated_protocol.dart

Issue 766323002: Compressed/optimized navigation notification. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updates for review comments. Created 6 years 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 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script 6 // To regenerate the file, use the script
7 // "pkg/analysis_server/tool/spec/generate_files". 7 // "pkg/analysis_server/tool/spec/generate_files".
8 8
9 part of protocol; 9 part of protocol;
10 /** 10 /**
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 return _JenkinsSmiHash.finish(hash); 1526 return _JenkinsSmiHash.finish(hash);
1527 } 1527 }
1528 } 1528 }
1529 1529
1530 /** 1530 /**
1531 * analysis.navigation params 1531 * analysis.navigation params
1532 * 1532 *
1533 * { 1533 * {
1534 * "file": FilePath 1534 * "file": FilePath
1535 * "regions": List<NavigationRegion> 1535 * "regions": List<NavigationRegion>
1536 * "targets": List<NavigationTarget>
1537 * "files": List<FilePath>
1536 * } 1538 * }
1537 */ 1539 */
1538 class AnalysisNavigationParams implements HasToJson { 1540 class AnalysisNavigationParams implements HasToJson {
1539 /** 1541 /**
1540 * The file containing the navigation regions. 1542 * The file containing the navigation regions.
1541 */ 1543 */
1542 String file; 1544 String file;
1543 1545
1544 /** 1546 /**
1545 * The navigation regions contained in the file. The regions are sorted by 1547 * The navigation regions contained in the file. The regions are sorted by
1546 * their offsets. Each navigation region represents a list of targets 1548 * their offsets. Each navigation region represents a list of targets
1547 * associated with some range. The lists will usually contain a single 1549 * associated with some range. The lists will usually contain a single
1548 * target, but can contain more in the case of a part that is included in 1550 * target, but can contain more in the case of a part that is included in
1549 * multiple libraries or in Dart code that is compiled against multiple 1551 * multiple libraries or in Dart code that is compiled against multiple
1550 * versions of a package. Note that the navigation regions that are returned 1552 * versions of a package. Note that the navigation regions that are returned
1551 * do not overlap other navigation regions. 1553 * do not overlap other navigation regions.
1552 */ 1554 */
1553 List<NavigationRegion> regions; 1555 List<NavigationRegion> regions;
1554 1556
1555 AnalysisNavigationParams(this.file, this.regions); 1557 /**
1558 * The navigation targets referenced in the file. They are referenced by
1559 * NavigationRegions by their index in this array.
1560 */
1561 List<NavigationTarget> targets;
1562
1563 /**
1564 * The files containing navigation targets referenced in the file. They are
1565 * referenced by NavigationTargets by their index in this array.
1566 */
1567 List<String> files;
1568
1569 AnalysisNavigationParams(this.file, this.regions, this.targets, this.files);
1556 1570
1557 factory AnalysisNavigationParams.fromJson(JsonDecoder jsonDecoder, String json Path, Object json) { 1571 factory AnalysisNavigationParams.fromJson(JsonDecoder jsonDecoder, String json Path, Object json) {
1558 if (json == null) { 1572 if (json == null) {
1559 json = {}; 1573 json = {};
1560 } 1574 }
1561 if (json is Map) { 1575 if (json is Map) {
1562 String file; 1576 String file;
1563 if (json.containsKey("file")) { 1577 if (json.containsKey("file")) {
1564 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); 1578 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]);
1565 } else { 1579 } else {
1566 throw jsonDecoder.missingKey(jsonPath, "file"); 1580 throw jsonDecoder.missingKey(jsonPath, "file");
1567 } 1581 }
1568 List<NavigationRegion> regions; 1582 List<NavigationRegion> regions;
1569 if (json.containsKey("regions")) { 1583 if (json.containsKey("regions")) {
1570 regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"] , (String jsonPath, Object json) => new NavigationRegion.fromJson(jsonDecoder, j sonPath, json)); 1584 regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"] , (String jsonPath, Object json) => new NavigationRegion.fromJson(jsonDecoder, j sonPath, json));
1571 } else { 1585 } else {
1572 throw jsonDecoder.missingKey(jsonPath, "regions"); 1586 throw jsonDecoder.missingKey(jsonPath, "regions");
1573 } 1587 }
1574 return new AnalysisNavigationParams(file, regions); 1588 List<NavigationTarget> targets;
1589 if (json.containsKey("targets")) {
1590 targets = jsonDecoder._decodeList(jsonPath + ".targets", json["targets"] , (String jsonPath, Object json) => new NavigationTarget.fromJson(jsonDecoder, j sonPath, json));
1591 } else {
1592 throw jsonDecoder.missingKey(jsonPath, "targets");
1593 }
1594 List<String> files;
1595 if (json.containsKey("files")) {
1596 files = jsonDecoder._decodeList(jsonPath + ".files", json["files"], json Decoder._decodeString);
1597 } else {
1598 throw jsonDecoder.missingKey(jsonPath, "files");
1599 }
1600 return new AnalysisNavigationParams(file, regions, targets, files);
1575 } else { 1601 } else {
1576 throw jsonDecoder.mismatch(jsonPath, "analysis.navigation params"); 1602 throw jsonDecoder.mismatch(jsonPath, "analysis.navigation params");
1577 } 1603 }
1578 } 1604 }
1579 1605
1580 factory AnalysisNavigationParams.fromNotification(Notification notification) { 1606 factory AnalysisNavigationParams.fromNotification(Notification notification) {
1581 return new AnalysisNavigationParams.fromJson( 1607 return new AnalysisNavigationParams.fromJson(
1582 new ResponseDecoder(null), "params", notification._params); 1608 new ResponseDecoder(null), "params", notification._params);
1583 } 1609 }
1584 1610
1585 Map<String, dynamic> toJson() { 1611 Map<String, dynamic> toJson() {
1586 Map<String, dynamic> result = {}; 1612 Map<String, dynamic> result = {};
1587 result["file"] = file; 1613 result["file"] = file;
1588 result["regions"] = regions.map((NavigationRegion value) => value.toJson()). toList(); 1614 result["regions"] = regions.map((NavigationRegion value) => value.toJson()). toList();
1615 result["targets"] = targets.map((NavigationTarget value) => value.toJson()). toList();
1616 result["files"] = files;
1589 return result; 1617 return result;
1590 } 1618 }
1591 1619
1592 Notification toNotification() { 1620 Notification toNotification() {
1593 return new Notification("analysis.navigation", toJson()); 1621 return new Notification("analysis.navigation", toJson());
1594 } 1622 }
1595 1623
1596 @override 1624 @override
1597 String toString() => JSON.encode(toJson()); 1625 String toString() => JSON.encode(toJson());
1598 1626
1599 @override 1627 @override
1600 bool operator==(other) { 1628 bool operator==(other) {
1601 if (other is AnalysisNavigationParams) { 1629 if (other is AnalysisNavigationParams) {
1602 return file == other.file && 1630 return file == other.file &&
1603 _listEqual(regions, other.regions, (NavigationRegion a, NavigationRegi on b) => a == b); 1631 _listEqual(regions, other.regions, (NavigationRegion a, NavigationRegi on b) => a == b) &&
1632 _listEqual(targets, other.targets, (NavigationTarget a, NavigationTarg et b) => a == b) &&
1633 _listEqual(files, other.files, (String a, String b) => a == b);
1604 } 1634 }
1605 return false; 1635 return false;
1606 } 1636 }
1607 1637
1608 @override 1638 @override
1609 int get hashCode { 1639 int get hashCode {
1610 int hash = 0; 1640 int hash = 0;
1611 hash = _JenkinsSmiHash.combine(hash, file.hashCode); 1641 hash = _JenkinsSmiHash.combine(hash, file.hashCode);
1612 hash = _JenkinsSmiHash.combine(hash, regions.hashCode); 1642 hash = _JenkinsSmiHash.combine(hash, regions.hashCode);
1643 hash = _JenkinsSmiHash.combine(hash, targets.hashCode);
1644 hash = _JenkinsSmiHash.combine(hash, files.hashCode);
1613 return _JenkinsSmiHash.finish(hash); 1645 return _JenkinsSmiHash.finish(hash);
1614 } 1646 }
1615 } 1647 }
1616 1648
1617 /** 1649 /**
1618 * analysis.occurrences params 1650 * analysis.occurrences params
1619 * 1651 *
1620 * { 1652 * {
1621 * "file": FilePath 1653 * "file": FilePath
1622 * "occurrences": List<Occurrences> 1654 * "occurrences": List<Occurrences>
(...skipping 5516 matching lines...) Expand 10 before | Expand all | Expand 10 after
7139 return _JenkinsSmiHash.finish(hash); 7171 return _JenkinsSmiHash.finish(hash);
7140 } 7172 }
7141 } 7173 }
7142 7174
7143 /** 7175 /**
7144 * NavigationRegion 7176 * NavigationRegion
7145 * 7177 *
7146 * { 7178 * {
7147 * "offset": int 7179 * "offset": int
7148 * "length": int 7180 * "length": int
7149 * "targets": List<Element> 7181 * "targets": List<int>
7150 * } 7182 * }
7151 */ 7183 */
7152 class NavigationRegion implements HasToJson { 7184 class NavigationRegion implements HasToJson {
7153 /** 7185 /**
7154 * The offset of the region from which the user can navigate. 7186 * The offset of the region from which the user can navigate.
7155 */ 7187 */
7156 int offset; 7188 int offset;
7157 7189
7158 /** 7190 /**
7159 * The length of the region from which the user can navigate. 7191 * The length of the region from which the user can navigate.
7160 */ 7192 */
7161 int length; 7193 int length;
7162 7194
7163 /** 7195 /**
7164 * The elements to which the given region is bound. By opening the 7196 * The indexes of the targets (in the enclosing navigation response) to which
7165 * declaration of the elements, clients can implement one form of navigation. 7197 * the given region is bound. By opening the target, clients can implement
7198 * one form of navigation.
7166 */ 7199 */
7167 List<Element> targets; 7200 List<int> targets;
7168 7201
7169 NavigationRegion(this.offset, this.length, this.targets); 7202 NavigationRegion(this.offset, this.length, this.targets);
7170 7203
7171 factory NavigationRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob ject json) { 7204 factory NavigationRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob ject json) {
7172 if (json == null) { 7205 if (json == null) {
7173 json = {}; 7206 json = {};
7174 } 7207 }
7175 if (json is Map) { 7208 if (json is Map) {
7176 int offset; 7209 int offset;
7177 if (json.containsKey("offset")) { 7210 if (json.containsKey("offset")) {
7178 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); 7211 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]);
7179 } else { 7212 } else {
7180 throw jsonDecoder.missingKey(jsonPath, "offset"); 7213 throw jsonDecoder.missingKey(jsonPath, "offset");
7181 } 7214 }
7182 int length; 7215 int length;
7183 if (json.containsKey("length")) { 7216 if (json.containsKey("length")) {
7184 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); 7217 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]);
7185 } else { 7218 } else {
7186 throw jsonDecoder.missingKey(jsonPath, "length"); 7219 throw jsonDecoder.missingKey(jsonPath, "length");
7187 } 7220 }
7188 List<Element> targets; 7221 List<int> targets;
7189 if (json.containsKey("targets")) { 7222 if (json.containsKey("targets")) {
7190 targets = jsonDecoder._decodeList(jsonPath + ".targets", json["targets"] , (String jsonPath, Object json) => new Element.fromJson(jsonDecoder, jsonPath, json)); 7223 targets = jsonDecoder._decodeList(jsonPath + ".targets", json["targets"] , jsonDecoder._decodeInt);
7191 } else { 7224 } else {
7192 throw jsonDecoder.missingKey(jsonPath, "targets"); 7225 throw jsonDecoder.missingKey(jsonPath, "targets");
7193 } 7226 }
7194 return new NavigationRegion(offset, length, targets); 7227 return new NavigationRegion(offset, length, targets);
7195 } else { 7228 } else {
7196 throw jsonDecoder.mismatch(jsonPath, "NavigationRegion"); 7229 throw jsonDecoder.mismatch(jsonPath, "NavigationRegion");
7197 } 7230 }
7198 } 7231 }
7199 7232
7200 Map<String, dynamic> toJson() { 7233 Map<String, dynamic> toJson() {
7201 Map<String, dynamic> result = {}; 7234 Map<String, dynamic> result = {};
7202 result["offset"] = offset; 7235 result["offset"] = offset;
7203 result["length"] = length; 7236 result["length"] = length;
7204 result["targets"] = targets.map((Element value) => value.toJson()).toList(); 7237 result["targets"] = targets;
7205 return result; 7238 return result;
7206 } 7239 }
7207 7240
7208 @override 7241 @override
7209 String toString() => JSON.encode(toJson()); 7242 String toString() => JSON.encode(toJson());
7210 7243
7211 @override 7244 @override
7212 bool operator==(other) { 7245 bool operator==(other) {
7213 if (other is NavigationRegion) { 7246 if (other is NavigationRegion) {
7214 return offset == other.offset && 7247 return offset == other.offset &&
7215 length == other.length && 7248 length == other.length &&
7216 _listEqual(targets, other.targets, (Element a, Element b) => a == b); 7249 _listEqual(targets, other.targets, (int a, int b) => a == b);
7217 } 7250 }
7218 return false; 7251 return false;
7219 } 7252 }
7220 7253
7221 @override 7254 @override
7222 int get hashCode { 7255 int get hashCode {
7223 int hash = 0; 7256 int hash = 0;
7224 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); 7257 hash = _JenkinsSmiHash.combine(hash, offset.hashCode);
7225 hash = _JenkinsSmiHash.combine(hash, length.hashCode); 7258 hash = _JenkinsSmiHash.combine(hash, length.hashCode);
7226 hash = _JenkinsSmiHash.combine(hash, targets.hashCode); 7259 hash = _JenkinsSmiHash.combine(hash, targets.hashCode);
7227 return _JenkinsSmiHash.finish(hash); 7260 return _JenkinsSmiHash.finish(hash);
7228 } 7261 }
7229 } 7262 }
7230 7263
7231 /** 7264 /**
7265 * NavigationTarget
7266 *
7267 * {
7268 * "kind": ElementKind
7269 * "fileIndex": int
7270 * "offset": int
7271 * "length": int
7272 * "startLine": int
7273 * "startColumn": int
7274 * }
7275 */
7276 class NavigationTarget implements HasToJson {
7277 /**
7278 * The kind of the element.
7279 */
7280 ElementKind kind;
7281
7282 /**
7283 * The index of the file (in the enclosing navigation response) to navigate
7284 * to.
7285 */
7286 int fileIndex;
7287
7288 /**
7289 * The offset of the region from which the user can navigate.
7290 */
7291 int offset;
7292
7293 /**
7294 * The length of the region from which the user can navigate.
7295 */
7296 int length;
7297
7298 /**
7299 * The one-based index of the line containing the first character of the
7300 * region.
7301 */
7302 int startLine;
7303
7304 /**
7305 * The one-based index of the column containing the first character of the
7306 * region.
7307 */
7308 int startColumn;
7309
7310 NavigationTarget(this.kind, this.fileIndex, this.offset, this.length, this.sta rtLine, this.startColumn);
7311
7312 factory NavigationTarget.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob ject json) {
7313 if (json == null) {
7314 json = {};
7315 }
7316 if (json is Map) {
7317 ElementKind kind;
7318 if (json.containsKey("kind")) {
7319 kind = new ElementKind.fromJson(jsonDecoder, jsonPath + ".kind", json["k ind"]);
7320 } else {
7321 throw jsonDecoder.missingKey(jsonPath, "kind");
7322 }
7323 int fileIndex;
7324 if (json.containsKey("fileIndex")) {
7325 fileIndex = jsonDecoder._decodeInt(jsonPath + ".fileIndex", json["fileIn dex"]);
7326 } else {
7327 throw jsonDecoder.missingKey(jsonPath, "fileIndex");
7328 }
7329 int offset;
7330 if (json.containsKey("offset")) {
7331 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]);
7332 } else {
7333 throw jsonDecoder.missingKey(jsonPath, "offset");
7334 }
7335 int length;
7336 if (json.containsKey("length")) {
7337 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]);
7338 } else {
7339 throw jsonDecoder.missingKey(jsonPath, "length");
7340 }
7341 int startLine;
7342 if (json.containsKey("startLine")) {
7343 startLine = jsonDecoder._decodeInt(jsonPath + ".startLine", json["startL ine"]);
7344 } else {
7345 throw jsonDecoder.missingKey(jsonPath, "startLine");
7346 }
7347 int startColumn;
7348 if (json.containsKey("startColumn")) {
7349 startColumn = jsonDecoder._decodeInt(jsonPath + ".startColumn", json["st artColumn"]);
7350 } else {
7351 throw jsonDecoder.missingKey(jsonPath, "startColumn");
7352 }
7353 return new NavigationTarget(kind, fileIndex, offset, length, startLine, st artColumn);
7354 } else {
7355 throw jsonDecoder.mismatch(jsonPath, "NavigationTarget");
7356 }
7357 }
7358
7359 Map<String, dynamic> toJson() {
7360 Map<String, dynamic> result = {};
7361 result["kind"] = kind.toJson();
7362 result["fileIndex"] = fileIndex;
7363 result["offset"] = offset;
7364 result["length"] = length;
7365 result["startLine"] = startLine;
7366 result["startColumn"] = startColumn;
7367 return result;
7368 }
7369
7370 @override
7371 String toString() => JSON.encode(toJson());
7372
7373 @override
7374 bool operator==(other) {
7375 if (other is NavigationTarget) {
7376 return kind == other.kind &&
7377 fileIndex == other.fileIndex &&
7378 offset == other.offset &&
7379 length == other.length &&
7380 startLine == other.startLine &&
7381 startColumn == other.startColumn;
7382 }
7383 return false;
7384 }
7385
7386 @override
7387 int get hashCode {
7388 int hash = 0;
7389 hash = _JenkinsSmiHash.combine(hash, kind.hashCode);
7390 hash = _JenkinsSmiHash.combine(hash, fileIndex.hashCode);
7391 hash = _JenkinsSmiHash.combine(hash, offset.hashCode);
7392 hash = _JenkinsSmiHash.combine(hash, length.hashCode);
7393 hash = _JenkinsSmiHash.combine(hash, startLine.hashCode);
7394 hash = _JenkinsSmiHash.combine(hash, startColumn.hashCode);
7395 return _JenkinsSmiHash.finish(hash);
7396 }
7397 }
7398
7399 /**
7232 * Occurrences 7400 * Occurrences
7233 * 7401 *
7234 * { 7402 * {
7235 * "element": Element 7403 * "element": Element
7236 * "offsets": List<int> 7404 * "offsets": List<int>
7237 * "length": int 7405 * "length": int
7238 * } 7406 * }
7239 */ 7407 */
7240 class Occurrences implements HasToJson { 7408 class Occurrences implements HasToJson {
7241 /** 7409 /**
(...skipping 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after
10227 return false; 10395 return false;
10228 } 10396 }
10229 10397
10230 @override 10398 @override
10231 int get hashCode { 10399 int get hashCode {
10232 int hash = 0; 10400 int hash = 0;
10233 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); 10401 hash = _JenkinsSmiHash.combine(hash, newName.hashCode);
10234 return _JenkinsSmiHash.finish(hash); 10402 return _JenkinsSmiHash.finish(hash);
10235 } 10403 }
10236 } 10404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698