mirror of
https://github.com/dart-lang/sdk
synced 2024-10-01 19:19:16 +00:00
Specification change for the 'libraryName' and 'partOfLibraryName' fields in Outline.
R=brianwilkerson@google.com, paulberry@google.com BUG= Review URL: https://codereview.chromium.org//1375163003 .
This commit is contained in:
parent
03b41129a2
commit
9d48af9ee3
File diff suppressed because one or more lines are too long
|
@ -3158,12 +3158,18 @@ class AnalysisOccurrencesParams implements HasToJson {
|
|||
*
|
||||
* {
|
||||
* "file": FilePath
|
||||
* "kind": FileKind
|
||||
* "libraryName": optional String
|
||||
* "outline": Outline
|
||||
* }
|
||||
*/
|
||||
class AnalysisOutlineParams implements HasToJson {
|
||||
String _file;
|
||||
|
||||
FileKind _kind;
|
||||
|
||||
String _libraryName;
|
||||
|
||||
Outline _outline;
|
||||
|
||||
/**
|
||||
|
@ -3179,6 +3185,39 @@ class AnalysisOutlineParams implements HasToJson {
|
|||
this._file = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the file.
|
||||
*/
|
||||
FileKind get kind => _kind;
|
||||
|
||||
/**
|
||||
* The kind of the file.
|
||||
*/
|
||||
void set kind(FileKind value) {
|
||||
assert(value != null);
|
||||
this._kind = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the library defined by the file using a "library" directive,
|
||||
* or referenced by a "part of" directive. If both "library" and "part of"
|
||||
* directives are present, then the "library" directive takes precedence.
|
||||
* This field will be omitted if the file has neither "library" nor "part of"
|
||||
* directives.
|
||||
*/
|
||||
String get libraryName => _libraryName;
|
||||
|
||||
/**
|
||||
* The name of the library defined by the file using a "library" directive,
|
||||
* or referenced by a "part of" directive. If both "library" and "part of"
|
||||
* directives are present, then the "library" directive takes precedence.
|
||||
* This field will be omitted if the file has neither "library" nor "part of"
|
||||
* directives.
|
||||
*/
|
||||
void set libraryName(String value) {
|
||||
this._libraryName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The outline associated with the file.
|
||||
*/
|
||||
|
@ -3192,8 +3231,10 @@ class AnalysisOutlineParams implements HasToJson {
|
|||
this._outline = value;
|
||||
}
|
||||
|
||||
AnalysisOutlineParams(String file, Outline outline) {
|
||||
AnalysisOutlineParams(String file, FileKind kind, Outline outline, {String libraryName}) {
|
||||
this.file = file;
|
||||
this.kind = kind;
|
||||
this.libraryName = libraryName;
|
||||
this.outline = outline;
|
||||
}
|
||||
|
||||
|
@ -3208,13 +3249,23 @@ class AnalysisOutlineParams implements HasToJson {
|
|||
} else {
|
||||
throw jsonDecoder.missingKey(jsonPath, "file");
|
||||
}
|
||||
FileKind kind;
|
||||
if (json.containsKey("kind")) {
|
||||
kind = new FileKind.fromJson(jsonDecoder, jsonPath + ".kind", json["kind"]);
|
||||
} else {
|
||||
throw jsonDecoder.missingKey(jsonPath, "kind");
|
||||
}
|
||||
String libraryName;
|
||||
if (json.containsKey("libraryName")) {
|
||||
libraryName = jsonDecoder._decodeString(jsonPath + ".libraryName", json["libraryName"]);
|
||||
}
|
||||
Outline outline;
|
||||
if (json.containsKey("outline")) {
|
||||
outline = new Outline.fromJson(jsonDecoder, jsonPath + ".outline", json["outline"]);
|
||||
} else {
|
||||
throw jsonDecoder.missingKey(jsonPath, "outline");
|
||||
}
|
||||
return new AnalysisOutlineParams(file, outline);
|
||||
return new AnalysisOutlineParams(file, kind, outline, libraryName: libraryName);
|
||||
} else {
|
||||
throw jsonDecoder.mismatch(jsonPath, "analysis.outline params", json);
|
||||
}
|
||||
|
@ -3228,6 +3279,10 @@ class AnalysisOutlineParams implements HasToJson {
|
|||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> result = {};
|
||||
result["file"] = file;
|
||||
result["kind"] = kind.toJson();
|
||||
if (libraryName != null) {
|
||||
result["libraryName"] = libraryName;
|
||||
}
|
||||
result["outline"] = outline.toJson();
|
||||
return result;
|
||||
}
|
||||
|
@ -3243,6 +3298,8 @@ class AnalysisOutlineParams implements HasToJson {
|
|||
bool operator==(other) {
|
||||
if (other is AnalysisOutlineParams) {
|
||||
return file == other.file &&
|
||||
kind == other.kind &&
|
||||
libraryName == other.libraryName &&
|
||||
outline == other.outline;
|
||||
}
|
||||
return false;
|
||||
|
@ -3252,6 +3309,8 @@ class AnalysisOutlineParams implements HasToJson {
|
|||
int get hashCode {
|
||||
int hash = 0;
|
||||
hash = _JenkinsSmiHash.combine(hash, file.hashCode);
|
||||
hash = _JenkinsSmiHash.combine(hash, kind.hashCode);
|
||||
hash = _JenkinsSmiHash.combine(hash, libraryName.hashCode);
|
||||
hash = _JenkinsSmiHash.combine(hash, outline.hashCode);
|
||||
return _JenkinsSmiHash.finish(hash);
|
||||
}
|
||||
|
@ -9510,6 +9569,55 @@ class ExecutionService implements Enum {
|
|||
String toJson() => name;
|
||||
}
|
||||
|
||||
/**
|
||||
* FileKind
|
||||
*
|
||||
* enum {
|
||||
* LIBRARY
|
||||
* PART
|
||||
* }
|
||||
*/
|
||||
class FileKind implements Enum {
|
||||
static const LIBRARY = const FileKind._("LIBRARY");
|
||||
|
||||
static const PART = const FileKind._("PART");
|
||||
|
||||
/**
|
||||
* A list containing all of the enum values that are defined.
|
||||
*/
|
||||
static const List<FileKind> VALUES = const <FileKind>[LIBRARY, PART];
|
||||
|
||||
final String name;
|
||||
|
||||
const FileKind._(this.name);
|
||||
|
||||
factory FileKind(String name) {
|
||||
switch (name) {
|
||||
case "LIBRARY":
|
||||
return LIBRARY;
|
||||
case "PART":
|
||||
return PART;
|
||||
}
|
||||
throw new Exception('Illegal enum value: $name');
|
||||
}
|
||||
|
||||
factory FileKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
||||
if (json is String) {
|
||||
try {
|
||||
return new FileKind(json);
|
||||
} catch(_) {
|
||||
// Fall through
|
||||
}
|
||||
}
|
||||
throw jsonDecoder.mismatch(jsonPath, "FileKind", json);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => "FileKind.$name";
|
||||
|
||||
String toJson() => name;
|
||||
}
|
||||
|
||||
/**
|
||||
* FoldingKind
|
||||
*
|
||||
|
|
|
@ -217,7 +217,8 @@ void sendAnalysisNotificationOutline(AnalysisServer server, String file,
|
|||
_sendNotification(server, () {
|
||||
var computer = new DartUnitOutlineComputer(file, lineInfo, dartUnit);
|
||||
var outline = computer.compute();
|
||||
var params = new protocol.AnalysisOutlineParams(file, outline);
|
||||
var params = new protocol.AnalysisOutlineParams(
|
||||
file, protocol.FileKind.LIBRARY, outline);
|
||||
server.sendNotification(params.toNotification());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -829,6 +829,18 @@ abstract class IntegrationTestMixin {
|
|||
*
|
||||
* The file with which the outline is associated.
|
||||
*
|
||||
* kind ( FileKind )
|
||||
*
|
||||
* The kind of the file.
|
||||
*
|
||||
* libraryName ( optional String )
|
||||
*
|
||||
* The name of the library defined by the file using a "library" directive,
|
||||
* or referenced by a "part of" directive. If both "library" and "part of"
|
||||
* directives are present, then the "library" directive takes precedence.
|
||||
* This field will be omitted if the file has neither "library" nor "part
|
||||
* of" directives.
|
||||
*
|
||||
* outline ( Outline )
|
||||
*
|
||||
* The outline associated with the file.
|
||||
|
|
|
@ -468,13 +468,18 @@ final Matcher isAnalysisOccurrencesParams = new LazyMatcher(() => new MatchesJso
|
|||
*
|
||||
* {
|
||||
* "file": FilePath
|
||||
* "kind": FileKind
|
||||
* "libraryName": optional String
|
||||
* "outline": Outline
|
||||
* }
|
||||
*/
|
||||
final Matcher isAnalysisOutlineParams = new LazyMatcher(() => new MatchesJsonObject(
|
||||
"analysis.outline params", {
|
||||
"file": isFilePath,
|
||||
"kind": isFileKind,
|
||||
"outline": isOutline
|
||||
}, optionalFields: {
|
||||
"libraryName": isString
|
||||
}));
|
||||
|
||||
/**
|
||||
|
@ -1378,6 +1383,19 @@ final Matcher isExecutionService = new MatchesEnum("ExecutionService", [
|
|||
"LAUNCH_DATA"
|
||||
]);
|
||||
|
||||
/**
|
||||
* FileKind
|
||||
*
|
||||
* enum {
|
||||
* LIBRARY
|
||||
* PART
|
||||
* }
|
||||
*/
|
||||
final Matcher isFileKind = new MatchesEnum("FileKind", [
|
||||
"LIBRARY",
|
||||
"PART"
|
||||
]);
|
||||
|
||||
/**
|
||||
* FilePath
|
||||
*
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2014, the Dart project authors.
|
||||
*
|
||||
* Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* This file has been automatically generated. Please do not edit it manually.
|
||||
* To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
|
||||
*/
|
||||
package org.dartlang.analysis.server.protocol;
|
||||
|
||||
/**
|
||||
* An enumeration of the kinds of files.
|
||||
*
|
||||
* @coverage dart.server.generated.types
|
||||
*/
|
||||
public class FileKind {
|
||||
|
||||
public static final String LIBRARY = "LIBRARY";
|
||||
|
||||
public static final String PART = "PART";
|
||||
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>Analysis Server API Specification</h1>
|
||||
<h1 style="color:#999999">Version <version>1.9.0</version></h1>
|
||||
<h1 style="color:#999999">Version <version>1.10.0</version></h1>
|
||||
<p>
|
||||
This document contains a specification of the API provided by the
|
||||
analysis server. The API in this document is currently under
|
||||
|
@ -1044,6 +1044,23 @@
|
|||
The file with which the outline is associated.
|
||||
</p>
|
||||
</field>
|
||||
<field name="kind">
|
||||
<ref>FileKind</ref>
|
||||
<p>
|
||||
The kind of the file.
|
||||
</p>
|
||||
</field>
|
||||
<field name="libraryName" optional="true">
|
||||
<ref>String</ref>
|
||||
<p>
|
||||
The name of the library defined by the file using a "library"
|
||||
directive, or referenced by a "part of" directive. If both
|
||||
"library" and "part of" directives are present, then the
|
||||
"library" directive takes precedence.
|
||||
This field will be omitted if the file has neither "library"
|
||||
nor "part of" directives.
|
||||
</p>
|
||||
</field>
|
||||
<field name="outline">
|
||||
<ref>Outline</ref>
|
||||
<p>
|
||||
|
@ -2551,6 +2568,15 @@
|
|||
<value><code>LAUNCH_DATA</code></value>
|
||||
</enum>
|
||||
</type>
|
||||
<type name="FileKind">
|
||||
<p>
|
||||
An enumeration of the kinds of files.
|
||||
</p>
|
||||
<enum>
|
||||
<value><code>LIBRARY</code></value>
|
||||
<value><code>PART</code></value>
|
||||
</enum>
|
||||
</type>
|
||||
<type name="FilePath">
|
||||
<ref>String</ref>
|
||||
<p>
|
||||
|
|
Loading…
Reference in a new issue