Update Analysis Server highlight API and implementation.

I think this is a good enough compromise between the existing and IDEA granilarity.

Eclipse plugin CL will follow.

(IN)VALID_STRING_ESCAPE are not implemented yet.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1227143003 .
This commit is contained in:
Konstantin Shcheglov 2015-07-09 11:19:44 -07:00
parent d503d2f0ed
commit 739847402b
9 changed files with 581 additions and 268 deletions

View file

@ -43,7 +43,7 @@ dt.typeDefinition {
</style></head>
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version 1.7.0</h1>
<h1 style="color:#999999">Version 2.0.0</h1>
<p>
This document contains a specification of the API provided by the
analysis server. The API in this document is currently under
@ -2653,7 +2653,7 @@ dt.typeDefinition {
applied to files.
</p>
<dl><dt class="value">ANNOTATION</dt><dt class="value">BUILT_IN</dt><dt class="value">CLASS</dt><dt class="value">COMMENT_BLOCK</dt><dt class="value">COMMENT_DOCUMENTATION</dt><dt class="value">COMMENT_END_OF_LINE</dt><dt class="value">CONSTRUCTOR</dt><dt class="value">DIRECTIVE</dt><dt class="value">DYNAMIC_TYPE</dt><dt class="value">ENUM</dt><dt class="value">ENUM_CONSTANT</dt><dt class="value">FIELD</dt><dt class="value">FIELD_STATIC</dt><dt class="value">FUNCTION</dt><dt class="value">FUNCTION_DECLARATION</dt><dt class="value">FUNCTION_TYPE_ALIAS</dt><dt class="value">GETTER_DECLARATION</dt><dt class="value">IDENTIFIER_DEFAULT</dt><dt class="value">IMPORT_PREFIX</dt><dt class="value">KEYWORD</dt><dt class="value">LABEL</dt><dt class="value">LITERAL_BOOLEAN</dt><dt class="value">LITERAL_DOUBLE</dt><dt class="value">LITERAL_INTEGER</dt><dt class="value">LITERAL_LIST</dt><dt class="value">LITERAL_MAP</dt><dt class="value">LITERAL_STRING</dt><dt class="value">LOCAL_VARIABLE</dt><dt class="value">LOCAL_VARIABLE_DECLARATION</dt><dt class="value">METHOD</dt><dt class="value">METHOD_DECLARATION</dt><dt class="value">METHOD_DECLARATION_STATIC</dt><dt class="value">METHOD_STATIC</dt><dt class="value">PARAMETER</dt><dt class="value">SETTER_DECLARATION</dt><dt class="value">TOP_LEVEL_VARIABLE</dt><dt class="value">TYPE_NAME_DYNAMIC</dt><dt class="value">TYPE_PARAMETER</dt></dl></dd><dt class="typeDefinition"><a name="type_HoverInformation">HoverInformation: object</a></dt><dd>
<dl><dt class="value">ANNOTATION</dt><dt class="value">BUILT_IN</dt><dt class="value">CLASS</dt><dt class="value">COMMENT_BLOCK</dt><dt class="value">COMMENT_DOCUMENTATION</dt><dt class="value">COMMENT_END_OF_LINE</dt><dt class="value">CONSTRUCTOR</dt><dt class="value">DIRECTIVE</dt><dt class="value">DYNAMIC_LOCAL_VARIABLE_DECLARATION</dt><dt class="value">DYNAMIC_LOCAL_VARIABLE_REFERENCE</dt><dt class="value">DYNAMIC_PARAMETER_DECLARATION</dt><dt class="value">DYNAMIC_PARAMETER_REFERENCE</dt><dt class="value">ENUM</dt><dt class="value">ENUM_CONSTANT</dt><dt class="value">FUNCTION_TYPE_ALIAS</dt><dt class="value">IDENTIFIER_DEFAULT</dt><dt class="value">IMPORT_PREFIX</dt><dt class="value">INSTANCE_FIELD_DECLARATION</dt><dt class="value">INSTANCE_FIELD_REFERENCE</dt><dt class="value">INSTANCE_GETTER_DECLARATION</dt><dt class="value">INSTANCE_GETTER_REFERENCE</dt><dt class="value">INSTANCE_METHOD_DECLARATION</dt><dt class="value">INSTANCE_METHOD_REFERENCE</dt><dt class="value">INSTANCE_SETTER_DECLARATION</dt><dt class="value">INSTANCE_SETTER_REFERENCE</dt><dt class="value">INVALID_STRING_ESCAPE</dt><dt class="value">KEYWORD</dt><dt class="value">LABEL</dt><dt class="value">LITERAL_BOOLEAN</dt><dt class="value">LITERAL_DOUBLE</dt><dt class="value">LITERAL_INTEGER</dt><dt class="value">LITERAL_LIST</dt><dt class="value">LITERAL_MAP</dt><dt class="value">LITERAL_STRING</dt><dt class="value">LOCAL_FUNCTION_DECLARATION</dt><dt class="value">LOCAL_FUNCTION_REFERENCE</dt><dt class="value">LOCAL_VARIABLE_DECLARATION</dt><dt class="value">LOCAL_VARIABLE_REFERENCE</dt><dt class="value">PARAMETER_DECLARATION</dt><dt class="value">PARAMETER_REFERENCE</dt><dt class="value">STATIC_FIELD_DECLARATION</dt><dt class="value">STATIC_GETTER_DECLARATION</dt><dt class="value">STATIC_GETTER_REFERENCE</dt><dt class="value">STATIC_METHOD_DECLARATION</dt><dt class="value">STATIC_METHOD_REFERENCE</dt><dt class="value">STATIC_SETTER_DECLARATION</dt><dt class="value">STATIC_SETTER_REFERENCE</dt><dt class="value">TOP_LEVEL_FUNCTION_DECLARATION</dt><dt class="value">TOP_LEVEL_FUNCTION_REFERENCE</dt><dt class="value">TOP_LEVEL_GETTER_DECLARATION</dt><dt class="value">TOP_LEVEL_GETTER_REFERENCE</dt><dt class="value">TOP_LEVEL_SETTER_DECLARATION</dt><dt class="value">TOP_LEVEL_SETTER_REFERENCE</dt><dt class="value">TOP_LEVEL_VARIABLE_DECLARATION</dt><dt class="value">TYPE_NAME_DYNAMIC</dt><dt class="value">TYPE_PARAMETER</dt><dt class="value">UNRESOLVED_INSTANCE_MEMBER_REFERENCE</dt><dt class="value">VALID_STRING_ESCAPE</dt></dl></dd><dt class="typeDefinition"><a name="type_HoverInformation">HoverInformation: object</a></dt><dd>
<p>
The hover information associated with a specific location.
</p>

View file

@ -72,7 +72,7 @@ class AnalysisServer {
* The version of the analysis server. The value should be replaced
* automatically during the build.
*/
static final String VERSION = '1.7.0';
static final String VERSION = '2.0.0';
/**
* The number of milliseconds to perform operations before inserting

View file

@ -63,7 +63,7 @@ class DartUnitHighlightsComputer {
if (_addIdentifierRegion_constructor(node)) {
return;
}
if (_addIdentifierRegion_dynamicType(node)) {
if (_addIdentifierRegion_dynamicLocal(node)) {
return;
}
if (_addIdentifierRegion_getterSetterDeclaration(node)) {
@ -135,13 +135,8 @@ class DartUnitHighlightsComputer {
return _addRegion_node(node, HighlightRegionType.CONSTRUCTOR);
}
bool _addIdentifierRegion_dynamicType(SimpleIdentifier node) {
// should be variable
Element element = node.staticElement;
if (element is! VariableElement) {
return false;
}
// has propagated type
bool _addIdentifierRegion_dynamicLocal(SimpleIdentifier node) {
// no propagated type
if (node.propagatedType != null) {
return false;
}
@ -151,7 +146,20 @@ class DartUnitHighlightsComputer {
return false;
}
// OK
return _addRegion_node(node, HighlightRegionType.DYNAMIC_TYPE);
Element element = node.staticElement;
if (element is LocalVariableElement) {
HighlightRegionType type = node.inDeclarationContext()
? HighlightRegionType.DYNAMIC_LOCAL_VARIABLE_DECLARATION
: HighlightRegionType.DYNAMIC_LOCAL_VARIABLE_REFERENCE;
return _addRegion_node(node, type);
}
if (element is ParameterElement) {
HighlightRegionType type = node.inDeclarationContext()
? HighlightRegionType.DYNAMIC_PARAMETER_DECLARATION
: HighlightRegionType.DYNAMIC_PARAMETER_REFERENCE;
return _addRegion_node(node, type);
}
return false;
}
bool _addIdentifierRegion_field(SimpleIdentifier node) {
@ -159,9 +167,6 @@ class DartUnitHighlightsComputer {
if (element is FieldFormalParameterElement) {
element = (element as FieldFormalParameterElement).field;
}
if (element is PropertyAccessorElement) {
element = (element as PropertyAccessorElement).variable;
}
// prepare type
HighlightRegionType type;
if (element is FieldElement) {
@ -169,12 +174,33 @@ class DartUnitHighlightsComputer {
if (enclosingElement is ClassElement && enclosingElement.isEnum) {
type = HighlightRegionType.ENUM_CONSTANT;
} else if (element.isStatic) {
type = HighlightRegionType.FIELD_STATIC;
type = HighlightRegionType.STATIC_FIELD_DECLARATION;
} else {
type = HighlightRegionType.FIELD;
type = node.inDeclarationContext()
? HighlightRegionType.INSTANCE_FIELD_DECLARATION
: HighlightRegionType.INSTANCE_FIELD_REFERENCE;
}
} else if (element is TopLevelVariableElement) {
type = HighlightRegionType.TOP_LEVEL_VARIABLE;
type = HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION;
}
if (element is PropertyAccessorElement) {
PropertyAccessorElement accessor = element;
Element enclosingElement = element.enclosingElement;
if (accessor.variable is TopLevelVariableElement) {
type = accessor.isGetter
? HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE
: HighlightRegionType.TOP_LEVEL_SETTER_REFERENCE;
} else if (enclosingElement is ClassElement && enclosingElement.isEnum) {
type = HighlightRegionType.ENUM_CONSTANT;
} else if (accessor.isStatic) {
type = accessor.isGetter
? HighlightRegionType.STATIC_GETTER_REFERENCE
: HighlightRegionType.STATIC_SETTER_REFERENCE;
} else {
type = accessor.isGetter
? HighlightRegionType.INSTANCE_GETTER_REFERENCE
: HighlightRegionType.INSTANCE_SETTER_REFERENCE;
}
}
// add region
if (type != null) {
@ -189,10 +215,15 @@ class DartUnitHighlightsComputer {
return false;
}
HighlightRegionType type;
bool isTopLevel = element.enclosingElement is CompilationUnitElement;
if (node.inDeclarationContext()) {
type = HighlightRegionType.FUNCTION_DECLARATION;
type = isTopLevel
? HighlightRegionType.TOP_LEVEL_FUNCTION_DECLARATION
: HighlightRegionType.LOCAL_FUNCTION_DECLARATION;
} else {
type = HighlightRegionType.FUNCTION;
type = isTopLevel
? HighlightRegionType.TOP_LEVEL_FUNCTION_REFERENCE
: HighlightRegionType.LOCAL_FUNCTION_REFERENCE;
}
return _addRegion_node(node, type);
}
@ -219,11 +250,26 @@ class DartUnitHighlightsComputer {
// getter or setter
PropertyAccessorElement propertyAccessorElement =
element as PropertyAccessorElement;
bool isTopLevel = element.enclosingElement is CompilationUnitElement;
HighlightRegionType type;
if (propertyAccessorElement.isGetter) {
return _addRegion_node(node, HighlightRegionType.GETTER_DECLARATION);
if (isTopLevel) {
type = HighlightRegionType.TOP_LEVEL_GETTER_DECLARATION;
} else if (propertyAccessorElement.isStatic) {
type = HighlightRegionType.STATIC_GETTER_DECLARATION;
} else {
type = HighlightRegionType.INSTANCE_GETTER_DECLARATION;
}
} else {
return _addRegion_node(node, HighlightRegionType.SETTER_DECLARATION);
if (isTopLevel) {
type = HighlightRegionType.TOP_LEVEL_SETTER_DECLARATION;
} else if (propertyAccessorElement.isStatic) {
type = HighlightRegionType.STATIC_SETTER_DECLARATION;
} else {
type = HighlightRegionType.INSTANCE_SETTER_DECLARATION;
}
}
return _addRegion_node(node, type);
}
bool _addIdentifierRegion_importPrefix(SimpleIdentifier node) {
@ -256,12 +302,9 @@ class DartUnitHighlightsComputer {
return false;
}
// OK
HighlightRegionType type;
if (node.inDeclarationContext()) {
type = HighlightRegionType.LOCAL_VARIABLE_DECLARATION;
} else {
type = HighlightRegionType.LOCAL_VARIABLE;
}
HighlightRegionType type = node.inDeclarationContext()
? HighlightRegionType.LOCAL_VARIABLE_DECLARATION
: HighlightRegionType.LOCAL_VARIABLE_REFERENCE;
return _addRegion_node(node, type);
}
@ -276,15 +319,15 @@ class DartUnitHighlightsComputer {
HighlightRegionType type;
if (node.inDeclarationContext()) {
if (isStatic) {
type = HighlightRegionType.METHOD_DECLARATION_STATIC;
type = HighlightRegionType.STATIC_METHOD_DECLARATION;
} else {
type = HighlightRegionType.METHOD_DECLARATION;
type = HighlightRegionType.INSTANCE_METHOD_DECLARATION;
}
} else {
if (isStatic) {
type = HighlightRegionType.METHOD_STATIC;
type = HighlightRegionType.STATIC_METHOD_REFERENCE;
} else {
type = HighlightRegionType.METHOD;
type = HighlightRegionType.INSTANCE_METHOD_REFERENCE;
}
}
return _addRegion_node(node, type);
@ -295,7 +338,10 @@ class DartUnitHighlightsComputer {
if (element is! ParameterElement) {
return false;
}
return _addRegion_node(node, HighlightRegionType.PARAMETER);
HighlightRegionType type = node.inDeclarationContext()
? HighlightRegionType.PARAMETER_DECLARATION
: HighlightRegionType.PARAMETER_REFERENCE;
return _addRegion_node(node, type);
}
bool _addIdentifierRegion_typeParameter(SimpleIdentifier node) {

View file

@ -9296,17 +9296,24 @@ class HighlightRegion implements HasToJson {
* COMMENT_END_OF_LINE
* CONSTRUCTOR
* DIRECTIVE
* DYNAMIC_TYPE
* DYNAMIC_LOCAL_VARIABLE_DECLARATION
* DYNAMIC_LOCAL_VARIABLE_REFERENCE
* DYNAMIC_PARAMETER_DECLARATION
* DYNAMIC_PARAMETER_REFERENCE
* ENUM
* ENUM_CONSTANT
* FIELD
* FIELD_STATIC
* FUNCTION
* FUNCTION_DECLARATION
* FUNCTION_TYPE_ALIAS
* GETTER_DECLARATION
* IDENTIFIER_DEFAULT
* IMPORT_PREFIX
* INSTANCE_FIELD_DECLARATION
* INSTANCE_FIELD_REFERENCE
* INSTANCE_GETTER_DECLARATION
* INSTANCE_GETTER_REFERENCE
* INSTANCE_METHOD_DECLARATION
* INSTANCE_METHOD_REFERENCE
* INSTANCE_SETTER_DECLARATION
* INSTANCE_SETTER_REFERENCE
* INVALID_STRING_ESCAPE
* KEYWORD
* LABEL
* LITERAL_BOOLEAN
@ -9315,17 +9322,30 @@ class HighlightRegion implements HasToJson {
* LITERAL_LIST
* LITERAL_MAP
* LITERAL_STRING
* LOCAL_VARIABLE
* LOCAL_FUNCTION_DECLARATION
* LOCAL_FUNCTION_REFERENCE
* LOCAL_VARIABLE_DECLARATION
* METHOD
* METHOD_DECLARATION
* METHOD_DECLARATION_STATIC
* METHOD_STATIC
* PARAMETER
* SETTER_DECLARATION
* TOP_LEVEL_VARIABLE
* LOCAL_VARIABLE_REFERENCE
* PARAMETER_DECLARATION
* PARAMETER_REFERENCE
* STATIC_FIELD_DECLARATION
* STATIC_GETTER_DECLARATION
* STATIC_GETTER_REFERENCE
* STATIC_METHOD_DECLARATION
* STATIC_METHOD_REFERENCE
* STATIC_SETTER_DECLARATION
* STATIC_SETTER_REFERENCE
* TOP_LEVEL_FUNCTION_DECLARATION
* TOP_LEVEL_FUNCTION_REFERENCE
* TOP_LEVEL_GETTER_DECLARATION
* TOP_LEVEL_GETTER_REFERENCE
* TOP_LEVEL_SETTER_DECLARATION
* TOP_LEVEL_SETTER_REFERENCE
* TOP_LEVEL_VARIABLE_DECLARATION
* TYPE_NAME_DYNAMIC
* TYPE_PARAMETER
* UNRESOLVED_INSTANCE_MEMBER_REFERENCE
* VALID_STRING_ESCAPE
* }
*/
class HighlightRegionType implements Enum {
@ -9345,28 +9365,42 @@ class HighlightRegionType implements Enum {
static const DIRECTIVE = const HighlightRegionType._("DIRECTIVE");
static const DYNAMIC_TYPE = const HighlightRegionType._("DYNAMIC_TYPE");
static const DYNAMIC_LOCAL_VARIABLE_DECLARATION = const HighlightRegionType._("DYNAMIC_LOCAL_VARIABLE_DECLARATION");
static const DYNAMIC_LOCAL_VARIABLE_REFERENCE = const HighlightRegionType._("DYNAMIC_LOCAL_VARIABLE_REFERENCE");
static const DYNAMIC_PARAMETER_DECLARATION = const HighlightRegionType._("DYNAMIC_PARAMETER_DECLARATION");
static const DYNAMIC_PARAMETER_REFERENCE = const HighlightRegionType._("DYNAMIC_PARAMETER_REFERENCE");
static const ENUM = const HighlightRegionType._("ENUM");
static const ENUM_CONSTANT = const HighlightRegionType._("ENUM_CONSTANT");
static const FIELD = const HighlightRegionType._("FIELD");
static const FIELD_STATIC = const HighlightRegionType._("FIELD_STATIC");
static const FUNCTION = const HighlightRegionType._("FUNCTION");
static const FUNCTION_DECLARATION = const HighlightRegionType._("FUNCTION_DECLARATION");
static const FUNCTION_TYPE_ALIAS = const HighlightRegionType._("FUNCTION_TYPE_ALIAS");
static const GETTER_DECLARATION = const HighlightRegionType._("GETTER_DECLARATION");
static const IDENTIFIER_DEFAULT = const HighlightRegionType._("IDENTIFIER_DEFAULT");
static const IMPORT_PREFIX = const HighlightRegionType._("IMPORT_PREFIX");
static const INSTANCE_FIELD_DECLARATION = const HighlightRegionType._("INSTANCE_FIELD_DECLARATION");
static const INSTANCE_FIELD_REFERENCE = const HighlightRegionType._("INSTANCE_FIELD_REFERENCE");
static const INSTANCE_GETTER_DECLARATION = const HighlightRegionType._("INSTANCE_GETTER_DECLARATION");
static const INSTANCE_GETTER_REFERENCE = const HighlightRegionType._("INSTANCE_GETTER_REFERENCE");
static const INSTANCE_METHOD_DECLARATION = const HighlightRegionType._("INSTANCE_METHOD_DECLARATION");
static const INSTANCE_METHOD_REFERENCE = const HighlightRegionType._("INSTANCE_METHOD_REFERENCE");
static const INSTANCE_SETTER_DECLARATION = const HighlightRegionType._("INSTANCE_SETTER_DECLARATION");
static const INSTANCE_SETTER_REFERENCE = const HighlightRegionType._("INSTANCE_SETTER_REFERENCE");
static const INVALID_STRING_ESCAPE = const HighlightRegionType._("INVALID_STRING_ESCAPE");
static const KEYWORD = const HighlightRegionType._("KEYWORD");
static const LABEL = const HighlightRegionType._("LABEL");
@ -9383,32 +9417,58 @@ class HighlightRegionType implements Enum {
static const LITERAL_STRING = const HighlightRegionType._("LITERAL_STRING");
static const LOCAL_VARIABLE = const HighlightRegionType._("LOCAL_VARIABLE");
static const LOCAL_FUNCTION_DECLARATION = const HighlightRegionType._("LOCAL_FUNCTION_DECLARATION");
static const LOCAL_FUNCTION_REFERENCE = const HighlightRegionType._("LOCAL_FUNCTION_REFERENCE");
static const LOCAL_VARIABLE_DECLARATION = const HighlightRegionType._("LOCAL_VARIABLE_DECLARATION");
static const METHOD = const HighlightRegionType._("METHOD");
static const LOCAL_VARIABLE_REFERENCE = const HighlightRegionType._("LOCAL_VARIABLE_REFERENCE");
static const METHOD_DECLARATION = const HighlightRegionType._("METHOD_DECLARATION");
static const PARAMETER_DECLARATION = const HighlightRegionType._("PARAMETER_DECLARATION");
static const METHOD_DECLARATION_STATIC = const HighlightRegionType._("METHOD_DECLARATION_STATIC");
static const PARAMETER_REFERENCE = const HighlightRegionType._("PARAMETER_REFERENCE");
static const METHOD_STATIC = const HighlightRegionType._("METHOD_STATIC");
static const STATIC_FIELD_DECLARATION = const HighlightRegionType._("STATIC_FIELD_DECLARATION");
static const PARAMETER = const HighlightRegionType._("PARAMETER");
static const STATIC_GETTER_DECLARATION = const HighlightRegionType._("STATIC_GETTER_DECLARATION");
static const SETTER_DECLARATION = const HighlightRegionType._("SETTER_DECLARATION");
static const STATIC_GETTER_REFERENCE = const HighlightRegionType._("STATIC_GETTER_REFERENCE");
static const TOP_LEVEL_VARIABLE = const HighlightRegionType._("TOP_LEVEL_VARIABLE");
static const STATIC_METHOD_DECLARATION = const HighlightRegionType._("STATIC_METHOD_DECLARATION");
static const STATIC_METHOD_REFERENCE = const HighlightRegionType._("STATIC_METHOD_REFERENCE");
static const STATIC_SETTER_DECLARATION = const HighlightRegionType._("STATIC_SETTER_DECLARATION");
static const STATIC_SETTER_REFERENCE = const HighlightRegionType._("STATIC_SETTER_REFERENCE");
static const TOP_LEVEL_FUNCTION_DECLARATION = const HighlightRegionType._("TOP_LEVEL_FUNCTION_DECLARATION");
static const TOP_LEVEL_FUNCTION_REFERENCE = const HighlightRegionType._("TOP_LEVEL_FUNCTION_REFERENCE");
static const TOP_LEVEL_GETTER_DECLARATION = const HighlightRegionType._("TOP_LEVEL_GETTER_DECLARATION");
static const TOP_LEVEL_GETTER_REFERENCE = const HighlightRegionType._("TOP_LEVEL_GETTER_REFERENCE");
static const TOP_LEVEL_SETTER_DECLARATION = const HighlightRegionType._("TOP_LEVEL_SETTER_DECLARATION");
static const TOP_LEVEL_SETTER_REFERENCE = const HighlightRegionType._("TOP_LEVEL_SETTER_REFERENCE");
static const TOP_LEVEL_VARIABLE_DECLARATION = const HighlightRegionType._("TOP_LEVEL_VARIABLE_DECLARATION");
static const TYPE_NAME_DYNAMIC = const HighlightRegionType._("TYPE_NAME_DYNAMIC");
static const TYPE_PARAMETER = const HighlightRegionType._("TYPE_PARAMETER");
static const UNRESOLVED_INSTANCE_MEMBER_REFERENCE = const HighlightRegionType._("UNRESOLVED_INSTANCE_MEMBER_REFERENCE");
static const VALID_STRING_ESCAPE = const HighlightRegionType._("VALID_STRING_ESCAPE");
/**
* A list containing all of the enum values that are defined.
*/
static const List<HighlightRegionType> VALUES = const <HighlightRegionType>[ANNOTATION, BUILT_IN, CLASS, COMMENT_BLOCK, COMMENT_DOCUMENTATION, COMMENT_END_OF_LINE, CONSTRUCTOR, DIRECTIVE, DYNAMIC_TYPE, ENUM, ENUM_CONSTANT, FIELD, FIELD_STATIC, FUNCTION, FUNCTION_DECLARATION, FUNCTION_TYPE_ALIAS, GETTER_DECLARATION, IDENTIFIER_DEFAULT, IMPORT_PREFIX, KEYWORD, LABEL, LITERAL_BOOLEAN, LITERAL_DOUBLE, LITERAL_INTEGER, LITERAL_LIST, LITERAL_MAP, LITERAL_STRING, LOCAL_VARIABLE, LOCAL_VARIABLE_DECLARATION, METHOD, METHOD_DECLARATION, METHOD_DECLARATION_STATIC, METHOD_STATIC, PARAMETER, SETTER_DECLARATION, TOP_LEVEL_VARIABLE, TYPE_NAME_DYNAMIC, TYPE_PARAMETER];
static const List<HighlightRegionType> VALUES = const <HighlightRegionType>[ANNOTATION, BUILT_IN, CLASS, COMMENT_BLOCK, COMMENT_DOCUMENTATION, COMMENT_END_OF_LINE, CONSTRUCTOR, DIRECTIVE, DYNAMIC_LOCAL_VARIABLE_DECLARATION, DYNAMIC_LOCAL_VARIABLE_REFERENCE, DYNAMIC_PARAMETER_DECLARATION, DYNAMIC_PARAMETER_REFERENCE, ENUM, ENUM_CONSTANT, FUNCTION_TYPE_ALIAS, IDENTIFIER_DEFAULT, IMPORT_PREFIX, INSTANCE_FIELD_DECLARATION, INSTANCE_FIELD_REFERENCE, INSTANCE_GETTER_DECLARATION, INSTANCE_GETTER_REFERENCE, INSTANCE_METHOD_DECLARATION, INSTANCE_METHOD_REFERENCE, INSTANCE_SETTER_DECLARATION, INSTANCE_SETTER_REFERENCE, INVALID_STRING_ESCAPE, KEYWORD, LABEL, LITERAL_BOOLEAN, LITERAL_DOUBLE, LITERAL_INTEGER, LITERAL_LIST, LITERAL_MAP, LITERAL_STRING, LOCAL_FUNCTION_DECLARATION, LOCAL_FUNCTION_REFERENCE, LOCAL_VARIABLE_DECLARATION, LOCAL_VARIABLE_REFERENCE, PARAMETER_DECLARATION, PARAMETER_REFERENCE, STATIC_FIELD_DECLARATION, STATIC_GETTER_DECLARATION, STATIC_GETTER_REFERENCE, STATIC_METHOD_DECLARATION, STATIC_METHOD_REFERENCE, STATIC_SETTER_DECLARATION, STATIC_SETTER_REFERENCE, TOP_LEVEL_FUNCTION_DECLARATION, TOP_LEVEL_FUNCTION_REFERENCE, TOP_LEVEL_GETTER_DECLARATION, TOP_LEVEL_GETTER_REFERENCE, TOP_LEVEL_SETTER_DECLARATION, TOP_LEVEL_SETTER_REFERENCE, TOP_LEVEL_VARIABLE_DECLARATION, TYPE_NAME_DYNAMIC, TYPE_PARAMETER, UNRESOLVED_INSTANCE_MEMBER_REFERENCE, VALID_STRING_ESCAPE];
final String name;
@ -9432,28 +9492,42 @@ class HighlightRegionType implements Enum {
return CONSTRUCTOR;
case "DIRECTIVE":
return DIRECTIVE;
case "DYNAMIC_TYPE":
return DYNAMIC_TYPE;
case "DYNAMIC_LOCAL_VARIABLE_DECLARATION":
return DYNAMIC_LOCAL_VARIABLE_DECLARATION;
case "DYNAMIC_LOCAL_VARIABLE_REFERENCE":
return DYNAMIC_LOCAL_VARIABLE_REFERENCE;
case "DYNAMIC_PARAMETER_DECLARATION":
return DYNAMIC_PARAMETER_DECLARATION;
case "DYNAMIC_PARAMETER_REFERENCE":
return DYNAMIC_PARAMETER_REFERENCE;
case "ENUM":
return ENUM;
case "ENUM_CONSTANT":
return ENUM_CONSTANT;
case "FIELD":
return FIELD;
case "FIELD_STATIC":
return FIELD_STATIC;
case "FUNCTION":
return FUNCTION;
case "FUNCTION_DECLARATION":
return FUNCTION_DECLARATION;
case "FUNCTION_TYPE_ALIAS":
return FUNCTION_TYPE_ALIAS;
case "GETTER_DECLARATION":
return GETTER_DECLARATION;
case "IDENTIFIER_DEFAULT":
return IDENTIFIER_DEFAULT;
case "IMPORT_PREFIX":
return IMPORT_PREFIX;
case "INSTANCE_FIELD_DECLARATION":
return INSTANCE_FIELD_DECLARATION;
case "INSTANCE_FIELD_REFERENCE":
return INSTANCE_FIELD_REFERENCE;
case "INSTANCE_GETTER_DECLARATION":
return INSTANCE_GETTER_DECLARATION;
case "INSTANCE_GETTER_REFERENCE":
return INSTANCE_GETTER_REFERENCE;
case "INSTANCE_METHOD_DECLARATION":
return INSTANCE_METHOD_DECLARATION;
case "INSTANCE_METHOD_REFERENCE":
return INSTANCE_METHOD_REFERENCE;
case "INSTANCE_SETTER_DECLARATION":
return INSTANCE_SETTER_DECLARATION;
case "INSTANCE_SETTER_REFERENCE":
return INSTANCE_SETTER_REFERENCE;
case "INVALID_STRING_ESCAPE":
return INVALID_STRING_ESCAPE;
case "KEYWORD":
return KEYWORD;
case "LABEL":
@ -9470,28 +9544,54 @@ class HighlightRegionType implements Enum {
return LITERAL_MAP;
case "LITERAL_STRING":
return LITERAL_STRING;
case "LOCAL_VARIABLE":
return LOCAL_VARIABLE;
case "LOCAL_FUNCTION_DECLARATION":
return LOCAL_FUNCTION_DECLARATION;
case "LOCAL_FUNCTION_REFERENCE":
return LOCAL_FUNCTION_REFERENCE;
case "LOCAL_VARIABLE_DECLARATION":
return LOCAL_VARIABLE_DECLARATION;
case "METHOD":
return METHOD;
case "METHOD_DECLARATION":
return METHOD_DECLARATION;
case "METHOD_DECLARATION_STATIC":
return METHOD_DECLARATION_STATIC;
case "METHOD_STATIC":
return METHOD_STATIC;
case "PARAMETER":
return PARAMETER;
case "SETTER_DECLARATION":
return SETTER_DECLARATION;
case "TOP_LEVEL_VARIABLE":
return TOP_LEVEL_VARIABLE;
case "LOCAL_VARIABLE_REFERENCE":
return LOCAL_VARIABLE_REFERENCE;
case "PARAMETER_DECLARATION":
return PARAMETER_DECLARATION;
case "PARAMETER_REFERENCE":
return PARAMETER_REFERENCE;
case "STATIC_FIELD_DECLARATION":
return STATIC_FIELD_DECLARATION;
case "STATIC_GETTER_DECLARATION":
return STATIC_GETTER_DECLARATION;
case "STATIC_GETTER_REFERENCE":
return STATIC_GETTER_REFERENCE;
case "STATIC_METHOD_DECLARATION":
return STATIC_METHOD_DECLARATION;
case "STATIC_METHOD_REFERENCE":
return STATIC_METHOD_REFERENCE;
case "STATIC_SETTER_DECLARATION":
return STATIC_SETTER_DECLARATION;
case "STATIC_SETTER_REFERENCE":
return STATIC_SETTER_REFERENCE;
case "TOP_LEVEL_FUNCTION_DECLARATION":
return TOP_LEVEL_FUNCTION_DECLARATION;
case "TOP_LEVEL_FUNCTION_REFERENCE":
return TOP_LEVEL_FUNCTION_REFERENCE;
case "TOP_LEVEL_GETTER_DECLARATION":
return TOP_LEVEL_GETTER_DECLARATION;
case "TOP_LEVEL_GETTER_REFERENCE":
return TOP_LEVEL_GETTER_REFERENCE;
case "TOP_LEVEL_SETTER_DECLARATION":
return TOP_LEVEL_SETTER_DECLARATION;
case "TOP_LEVEL_SETTER_REFERENCE":
return TOP_LEVEL_SETTER_REFERENCE;
case "TOP_LEVEL_VARIABLE_DECLARATION":
return TOP_LEVEL_VARIABLE_DECLARATION;
case "TYPE_NAME_DYNAMIC":
return TYPE_NAME_DYNAMIC;
case "TYPE_PARAMETER":
return TYPE_PARAMETER;
case "UNRESOLVED_INSTANCE_MEMBER_REFERENCE":
return UNRESOLVED_INSTANCE_MEMBER_REFERENCE;
case "VALID_STRING_ESCAPE":
return VALID_STRING_ESCAPE;
}
throw new Exception('Illegal enum value: $name');
}

View file

@ -569,21 +569,46 @@ part of lib;
});
}
test_DYNAMIC_TYPE() {
test_DYNAMIC_LOCAL_VARIABLE() {
addTestFile('''
f() {}
main(p) {
print(p);
var v1 = f();
int v2;
var v3 = v2;
var v = f();
v;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.DYNAMIC_TYPE, 'p)');
assertHasRegion(HighlightRegionType.DYNAMIC_TYPE, 'v1 =');
assertNoRegion(HighlightRegionType.DYNAMIC_TYPE, 'v2;');
assertNoRegion(HighlightRegionType.DYNAMIC_TYPE, 'v3 =');
assertHasRegion(
HighlightRegionType.DYNAMIC_LOCAL_VARIABLE_DECLARATION, 'v = f()');
assertHasRegion(
HighlightRegionType.DYNAMIC_LOCAL_VARIABLE_REFERENCE, 'v;');
});
}
test_DYNAMIC_PARAMETER() {
addTestFile('''
main(p) {
print(p);
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.DYNAMIC_PARAMETER_DECLARATION, 'p)');
assertHasRegion(HighlightRegionType.DYNAMIC_PARAMETER_REFERENCE, 'p);');
});
}
test_DYNAMIC_VARIABLE_field() {
addTestFile('''
class A {
var f;
m() {
f = 1;
}
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'f;');
assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'f = 1');
});
}
@ -614,61 +639,6 @@ main() {
});
}
test_FIELD() {
addTestFile('''
class A {
int aaa = 1;
int bbb = 2;
A([this.bbb = 3]);
}
main(A a) {
a.aaa = 4;
a.bbb = 5;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.FIELD, 'aaa = 1');
assertHasRegion(HighlightRegionType.FIELD, 'bbb = 2');
assertHasRegion(HighlightRegionType.FIELD, 'bbb = 3');
assertHasRegion(HighlightRegionType.FIELD, 'aaa = 4');
assertHasRegion(HighlightRegionType.FIELD, 'bbb = 5');
});
}
test_FIELD_STATIC() {
addTestFile('''
class A {
static aaa = 1;
static get bbb => null;
static set ccc(x) {}
}
main() {
A.aaa = 2;
A.bbb;
A.ccc = 3;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.FIELD_STATIC, 'aaa = 1');
assertHasRegion(HighlightRegionType.FIELD_STATIC, 'aaa = 2');
assertHasRegion(HighlightRegionType.FIELD_STATIC, 'bbb;');
assertHasRegion(HighlightRegionType.FIELD_STATIC, 'ccc = 3');
});
}
test_FUNCTION() {
addTestFile('''
fff(p) {}
main() {
fff(42);
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.FUNCTION_DECLARATION, 'fff(p) {}');
assertHasRegion(HighlightRegionType.FUNCTION, 'fff(42)');
});
}
test_FUNCTION_TYPE_ALIAS() {
addTestFile('''
typedef FFF(p);
@ -681,22 +651,29 @@ main(FFF fff) {
});
}
test_GETTER_DECLARATION() {
test_GETTER() {
addTestFile('''
get aaa => null;
class A {
get bbb => null;
static get ccc => null;
}
main(A a) {
aaa;
a.bbb;
A.ccc;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.GETTER_DECLARATION, 'aaa => null');
assertHasRegion(HighlightRegionType.GETTER_DECLARATION, 'bbb => null');
assertHasRegion(HighlightRegionType.TOP_LEVEL_VARIABLE, 'aaa;');
assertHasRegion(HighlightRegionType.FIELD, 'bbb;');
assertHasRegion(
HighlightRegionType.TOP_LEVEL_GETTER_DECLARATION, 'aaa => null');
assertHasRegion(
HighlightRegionType.INSTANCE_GETTER_DECLARATION, 'bbb => null');
assertHasRegion(
HighlightRegionType.STATIC_GETTER_DECLARATION, 'ccc => null');
assertHasRegion(HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE, 'aaa;');
assertHasRegion(HighlightRegionType.INSTANCE_GETTER_REFERENCE, 'bbb;');
assertHasRegion(HighlightRegionType.STATIC_GETTER_REFERENCE, 'ccc;');
});
}
@ -728,6 +705,29 @@ main() {
});
}
test_INSTANCE_FIELD() {
addTestFile('''
class A {
int aaa = 1;
int bbb = 2;
A([this.bbb = 3]);
}
main(A a) {
a.aaa = 4;
a.bbb = 5;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(
HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'aaa = 1');
assertHasRegion(
HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'bbb = 2');
assertHasRegion(HighlightRegionType.INSTANCE_FIELD_REFERENCE, 'bbb = 3');
assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'aaa = 4');
assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'bbb = 5');
});
}
test_KEYWORD() {
addTestFile('''
main() {
@ -862,6 +862,22 @@ myLabel:
});
}
test_LOCAL_FUNCTION() {
addTestFile('''
main() {
fff() {}
fff();
fff;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(
HighlightRegionType.LOCAL_FUNCTION_DECLARATION, 'fff() {}');
assertHasRegion(HighlightRegionType.LOCAL_FUNCTION_REFERENCE, 'fff();');
assertHasRegion(HighlightRegionType.LOCAL_FUNCTION_REFERENCE, 'fff;');
});
}
test_LOCAL_VARIABLE() {
addTestFile('''
main() {
@ -873,8 +889,8 @@ main() {
return prepareHighlights().then((_) {
assertHasRegion(
HighlightRegionType.LOCAL_VARIABLE_DECLARATION, 'vvv = 0');
assertHasRegion(HighlightRegionType.LOCAL_VARIABLE, 'vvv;');
assertHasRegion(HighlightRegionType.LOCAL_VARIABLE, 'vvv = 1;');
assertHasRegion(HighlightRegionType.LOCAL_VARIABLE_REFERENCE, 'vvv;');
assertHasRegion(HighlightRegionType.LOCAL_VARIABLE_REFERENCE, 'vvv = 1;');
});
}
@ -892,13 +908,14 @@ main(A a) {
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.METHOD_DECLARATION, 'aaa() {}');
assertHasRegion(
HighlightRegionType.METHOD_DECLARATION_STATIC, 'bbb() {}');
assertHasRegion(HighlightRegionType.METHOD, 'aaa();');
assertHasRegion(HighlightRegionType.METHOD, 'aaa;');
assertHasRegion(HighlightRegionType.METHOD_STATIC, 'bbb();');
assertHasRegion(HighlightRegionType.METHOD_STATIC, 'bbb;');
HighlightRegionType.INSTANCE_METHOD_DECLARATION, 'aaa() {}');
assertHasRegion(
HighlightRegionType.STATIC_METHOD_DECLARATION, 'bbb() {}');
assertHasRegion(HighlightRegionType.INSTANCE_METHOD_REFERENCE, 'aaa();');
assertHasRegion(HighlightRegionType.INSTANCE_METHOD_REFERENCE, 'aaa;');
assertHasRegion(HighlightRegionType.STATIC_METHOD_REFERENCE, 'bbb();');
assertHasRegion(HighlightRegionType.STATIC_METHOD_REFERENCE, 'bbb;');
});
}
@ -911,7 +928,8 @@ main(p) {
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.METHOD, 'add(null)');
assertHasRegion(
HighlightRegionType.INSTANCE_METHOD_REFERENCE, 'add(null)');
});
}
@ -923,9 +941,9 @@ main(int p) {
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.PARAMETER, 'p) {');
assertHasRegion(HighlightRegionType.PARAMETER, 'p;');
assertHasRegion(HighlightRegionType.PARAMETER, 'p = 42');
assertHasRegion(HighlightRegionType.PARAMETER_DECLARATION, 'p) {');
assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p;');
assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p = 42');
});
}
@ -934,35 +952,82 @@ main(int p) {
set aaa(x) {}
class A {
set bbb(x) {}
static set ccc(x) {}
}
main(A a) {
aaa = 1;
a.bbb = 2;
A.ccc = 3;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.SETTER_DECLARATION, 'aaa(x)');
assertHasRegion(HighlightRegionType.SETTER_DECLARATION, 'bbb(x)');
assertHasRegion(HighlightRegionType.TOP_LEVEL_VARIABLE, 'aaa = 1');
assertHasRegion(HighlightRegionType.FIELD, 'bbb = 2');
assertHasRegion(
HighlightRegionType.TOP_LEVEL_SETTER_DECLARATION, 'aaa(x)');
assertHasRegion(
HighlightRegionType.INSTANCE_SETTER_DECLARATION, 'bbb(x)');
assertHasRegion(HighlightRegionType.STATIC_SETTER_DECLARATION, 'ccc(x)');
assertHasRegion(
HighlightRegionType.TOP_LEVEL_SETTER_REFERENCE, 'aaa = 1');
assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'bbb = 2');
assertHasRegion(HighlightRegionType.STATIC_SETTER_REFERENCE, 'ccc = 3');
});
}
test_STATIC_FIELD() {
addTestFile('''
class A {
static aaa = 1;
static get bbb => null;
static set ccc(x) {}
}
main() {
A.aaa = 2;
A.bbb;
A.ccc = 3;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.STATIC_FIELD_DECLARATION, 'aaa = 1');
assertHasRegion(HighlightRegionType.STATIC_SETTER_REFERENCE, 'aaa = 2');
assertHasRegion(HighlightRegionType.STATIC_GETTER_REFERENCE, 'bbb;');
assertHasRegion(HighlightRegionType.STATIC_SETTER_REFERENCE, 'ccc = 3');
});
}
test_TOP_LEVEL_FUNCTION() {
addTestFile('''
fff(p) {}
main() {
fff(42);
}
''');
return prepareHighlights().then((_) {
assertHasRegion(
HighlightRegionType.TOP_LEVEL_FUNCTION_DECLARATION, 'fff(p) {}');
assertHasRegion(
HighlightRegionType.TOP_LEVEL_FUNCTION_REFERENCE, 'fff(42)');
});
}
test_TOP_LEVEL_VARIABLE() {
addTestFile('''
const VVV = 0;
@VVV // annotation
const V1 = 1;
var V2 = 2;
@V1 // annotation
main() {
print(VVV);
VVV = 1;
print(V1);
V2 = 3;
}
''');
return prepareHighlights().then((_) {
assertHasRegion(HighlightRegionType.TOP_LEVEL_VARIABLE, 'VVV = 0');
assertHasRegion(
HighlightRegionType.TOP_LEVEL_VARIABLE, 'VVV // annotation');
assertHasRegion(HighlightRegionType.TOP_LEVEL_VARIABLE, 'VVV);');
assertHasRegion(HighlightRegionType.TOP_LEVEL_VARIABLE, 'VVV = 1');
HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION, 'V1 = 1');
assertHasRegion(
HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION, 'V2 = 2');
assertHasRegion(
HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE, 'V1 // annotation');
assertHasRegion(HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE, 'V1);');
assertHasRegion(HighlightRegionType.TOP_LEVEL_SETTER_REFERENCE, 'V2 = 3');
});
}

View file

@ -49,6 +49,7 @@ class Class<TypeParameter> {
}
set setter(int parameter) {
print(parameter);
}
}
@ -118,13 +119,14 @@ int topLevelVariable;
HighlightRegionType.COMMENT_END_OF_LINE, ['// End of line comment']);
check(HighlightRegionType.CONSTRUCTOR, ['constructor']);
check(HighlightRegionType.DIRECTIVE, ["import 'dart:async' as async;"]);
check(HighlightRegionType.DYNAMIC_TYPE, ['dynamicType']);
check(HighlightRegionType.FIELD, ['field']);
check(HighlightRegionType.FIELD_STATIC, ['staticField']);
check(HighlightRegionType.FUNCTION, ['print']);
check(HighlightRegionType.FUNCTION_DECLARATION, ['function']);
check(HighlightRegionType.DYNAMIC_PARAMETER_DECLARATION, ['dynamicType']);
check(HighlightRegionType.INSTANCE_FIELD_DECLARATION, ['field']);
check(HighlightRegionType.INSTANCE_SETTER_REFERENCE, ['field']);
check(HighlightRegionType.STATIC_FIELD_DECLARATION, ['staticField']);
check(HighlightRegionType.TOP_LEVEL_FUNCTION_REFERENCE, ['print']);
check(HighlightRegionType.TOP_LEVEL_FUNCTION_DECLARATION, ['function']);
check(HighlightRegionType.FUNCTION_TYPE_ALIAS, ['functionType']);
check(HighlightRegionType.GETTER_DECLARATION, ['getter']);
check(HighlightRegionType.INSTANCE_GETTER_DECLARATION, ['getter']);
check(HighlightRegionType.IDENTIFIER_DEFAULT, ['unresolvedIdentifier']);
check(HighlightRegionType.IMPORT_PREFIX, ['async']);
check(HighlightRegionType.KEYWORD, ['class', 'true', 'return']);
@ -137,18 +139,18 @@ int topLevelVariable;
'{2: local}'
]);
check(HighlightRegionType.LITERAL_STRING, ["'dart:async'", "'string'"]);
check(HighlightRegionType.LOCAL_VARIABLE, ['local']);
check(HighlightRegionType.LOCAL_VARIABLE_DECLARATION, ['local']);
check(HighlightRegionType.METHOD, ['toList']);
check(HighlightRegionType.METHOD_DECLARATION, ['method']);
check(HighlightRegionType.METHOD_DECLARATION_STATIC, ['staticMethod']);
check(HighlightRegionType.METHOD_STATIC, ['wait']);
check(HighlightRegionType.PARAMETER, ['parameter']);
check(HighlightRegionType.SETTER_DECLARATION, ['setter']);
check(HighlightRegionType.TOP_LEVEL_VARIABLE, [
'override',
'topLevelVariable'
]);
check(HighlightRegionType.LOCAL_VARIABLE_REFERENCE, ['local']);
check(HighlightRegionType.INSTANCE_METHOD_REFERENCE, ['toList']);
check(HighlightRegionType.INSTANCE_METHOD_DECLARATION, ['method']);
check(HighlightRegionType.STATIC_METHOD_DECLARATION, ['staticMethod']);
check(HighlightRegionType.STATIC_METHOD_REFERENCE, ['wait']);
check(HighlightRegionType.PARAMETER_DECLARATION, ['parameter']);
check(HighlightRegionType.PARAMETER_REFERENCE, ['parameter']);
check(HighlightRegionType.INSTANCE_SETTER_DECLARATION, ['setter']);
check(HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE, ['override']);
check(HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION,
['topLevelVariable']);
check(HighlightRegionType.TYPE_NAME_DYNAMIC, ['dynamic']);
check(HighlightRegionType.TYPE_PARAMETER, ['TypeParameter']);
expect(highlights, isEmpty);

View file

@ -1372,17 +1372,24 @@ final Matcher isHighlightRegion = new LazyMatcher(() => new MatchesJsonObject(
* COMMENT_END_OF_LINE
* CONSTRUCTOR
* DIRECTIVE
* DYNAMIC_TYPE
* DYNAMIC_LOCAL_VARIABLE_DECLARATION
* DYNAMIC_LOCAL_VARIABLE_REFERENCE
* DYNAMIC_PARAMETER_DECLARATION
* DYNAMIC_PARAMETER_REFERENCE
* ENUM
* ENUM_CONSTANT
* FIELD
* FIELD_STATIC
* FUNCTION
* FUNCTION_DECLARATION
* FUNCTION_TYPE_ALIAS
* GETTER_DECLARATION
* IDENTIFIER_DEFAULT
* IMPORT_PREFIX
* INSTANCE_FIELD_DECLARATION
* INSTANCE_FIELD_REFERENCE
* INSTANCE_GETTER_DECLARATION
* INSTANCE_GETTER_REFERENCE
* INSTANCE_METHOD_DECLARATION
* INSTANCE_METHOD_REFERENCE
* INSTANCE_SETTER_DECLARATION
* INSTANCE_SETTER_REFERENCE
* INVALID_STRING_ESCAPE
* KEYWORD
* LABEL
* LITERAL_BOOLEAN
@ -1391,17 +1398,30 @@ final Matcher isHighlightRegion = new LazyMatcher(() => new MatchesJsonObject(
* LITERAL_LIST
* LITERAL_MAP
* LITERAL_STRING
* LOCAL_VARIABLE
* LOCAL_FUNCTION_DECLARATION
* LOCAL_FUNCTION_REFERENCE
* LOCAL_VARIABLE_DECLARATION
* METHOD
* METHOD_DECLARATION
* METHOD_DECLARATION_STATIC
* METHOD_STATIC
* PARAMETER
* SETTER_DECLARATION
* TOP_LEVEL_VARIABLE
* LOCAL_VARIABLE_REFERENCE
* PARAMETER_DECLARATION
* PARAMETER_REFERENCE
* STATIC_FIELD_DECLARATION
* STATIC_GETTER_DECLARATION
* STATIC_GETTER_REFERENCE
* STATIC_METHOD_DECLARATION
* STATIC_METHOD_REFERENCE
* STATIC_SETTER_DECLARATION
* STATIC_SETTER_REFERENCE
* TOP_LEVEL_FUNCTION_DECLARATION
* TOP_LEVEL_FUNCTION_REFERENCE
* TOP_LEVEL_GETTER_DECLARATION
* TOP_LEVEL_GETTER_REFERENCE
* TOP_LEVEL_SETTER_DECLARATION
* TOP_LEVEL_SETTER_REFERENCE
* TOP_LEVEL_VARIABLE_DECLARATION
* TYPE_NAME_DYNAMIC
* TYPE_PARAMETER
* UNRESOLVED_INSTANCE_MEMBER_REFERENCE
* VALID_STRING_ESCAPE
* }
*/
final Matcher isHighlightRegionType = new MatchesEnum("HighlightRegionType", [
@ -1413,17 +1433,24 @@ final Matcher isHighlightRegionType = new MatchesEnum("HighlightRegionType", [
"COMMENT_END_OF_LINE",
"CONSTRUCTOR",
"DIRECTIVE",
"DYNAMIC_TYPE",
"DYNAMIC_LOCAL_VARIABLE_DECLARATION",
"DYNAMIC_LOCAL_VARIABLE_REFERENCE",
"DYNAMIC_PARAMETER_DECLARATION",
"DYNAMIC_PARAMETER_REFERENCE",
"ENUM",
"ENUM_CONSTANT",
"FIELD",
"FIELD_STATIC",
"FUNCTION",
"FUNCTION_DECLARATION",
"FUNCTION_TYPE_ALIAS",
"GETTER_DECLARATION",
"IDENTIFIER_DEFAULT",
"IMPORT_PREFIX",
"INSTANCE_FIELD_DECLARATION",
"INSTANCE_FIELD_REFERENCE",
"INSTANCE_GETTER_DECLARATION",
"INSTANCE_GETTER_REFERENCE",
"INSTANCE_METHOD_DECLARATION",
"INSTANCE_METHOD_REFERENCE",
"INSTANCE_SETTER_DECLARATION",
"INSTANCE_SETTER_REFERENCE",
"INVALID_STRING_ESCAPE",
"KEYWORD",
"LABEL",
"LITERAL_BOOLEAN",
@ -1432,17 +1459,30 @@ final Matcher isHighlightRegionType = new MatchesEnum("HighlightRegionType", [
"LITERAL_LIST",
"LITERAL_MAP",
"LITERAL_STRING",
"LOCAL_VARIABLE",
"LOCAL_FUNCTION_DECLARATION",
"LOCAL_FUNCTION_REFERENCE",
"LOCAL_VARIABLE_DECLARATION",
"METHOD",
"METHOD_DECLARATION",
"METHOD_DECLARATION_STATIC",
"METHOD_STATIC",
"PARAMETER",
"SETTER_DECLARATION",
"TOP_LEVEL_VARIABLE",
"LOCAL_VARIABLE_REFERENCE",
"PARAMETER_DECLARATION",
"PARAMETER_REFERENCE",
"STATIC_FIELD_DECLARATION",
"STATIC_GETTER_DECLARATION",
"STATIC_GETTER_REFERENCE",
"STATIC_METHOD_DECLARATION",
"STATIC_METHOD_REFERENCE",
"STATIC_SETTER_DECLARATION",
"STATIC_SETTER_REFERENCE",
"TOP_LEVEL_FUNCTION_DECLARATION",
"TOP_LEVEL_FUNCTION_REFERENCE",
"TOP_LEVEL_GETTER_DECLARATION",
"TOP_LEVEL_GETTER_REFERENCE",
"TOP_LEVEL_SETTER_DECLARATION",
"TOP_LEVEL_SETTER_REFERENCE",
"TOP_LEVEL_VARIABLE_DECLARATION",
"TYPE_NAME_DYNAMIC",
"TYPE_PARAMETER"
"TYPE_PARAMETER",
"UNRESOLVED_INSTANCE_MEMBER_REFERENCE",
"VALID_STRING_ESCAPE"
]);
/**

View file

@ -39,28 +39,42 @@ public class HighlightRegionType {
public static final String DIRECTIVE = "DIRECTIVE";
public static final String DYNAMIC_TYPE = "DYNAMIC_TYPE";
public static final String DYNAMIC_LOCAL_VARIABLE_DECLARATION = "DYNAMIC_LOCAL_VARIABLE_DECLARATION";
public static final String DYNAMIC_LOCAL_VARIABLE_REFERENCE = "DYNAMIC_LOCAL_VARIABLE_REFERENCE";
public static final String DYNAMIC_PARAMETER_DECLARATION = "DYNAMIC_PARAMETER_DECLARATION";
public static final String DYNAMIC_PARAMETER_REFERENCE = "DYNAMIC_PARAMETER_REFERENCE";
public static final String ENUM = "ENUM";
public static final String ENUM_CONSTANT = "ENUM_CONSTANT";
public static final String FIELD = "FIELD";
public static final String FIELD_STATIC = "FIELD_STATIC";
public static final String FUNCTION = "FUNCTION";
public static final String FUNCTION_DECLARATION = "FUNCTION_DECLARATION";
public static final String FUNCTION_TYPE_ALIAS = "FUNCTION_TYPE_ALIAS";
public static final String GETTER_DECLARATION = "GETTER_DECLARATION";
public static final String IDENTIFIER_DEFAULT = "IDENTIFIER_DEFAULT";
public static final String IMPORT_PREFIX = "IMPORT_PREFIX";
public static final String INSTANCE_FIELD_DECLARATION = "INSTANCE_FIELD_DECLARATION";
public static final String INSTANCE_FIELD_REFERENCE = "INSTANCE_FIELD_REFERENCE";
public static final String INSTANCE_GETTER_DECLARATION = "INSTANCE_GETTER_DECLARATION";
public static final String INSTANCE_GETTER_REFERENCE = "INSTANCE_GETTER_REFERENCE";
public static final String INSTANCE_METHOD_DECLARATION = "INSTANCE_METHOD_DECLARATION";
public static final String INSTANCE_METHOD_REFERENCE = "INSTANCE_METHOD_REFERENCE";
public static final String INSTANCE_SETTER_DECLARATION = "INSTANCE_SETTER_DECLARATION";
public static final String INSTANCE_SETTER_REFERENCE = "INSTANCE_SETTER_REFERENCE";
public static final String INVALID_STRING_ESCAPE = "INVALID_STRING_ESCAPE";
public static final String KEYWORD = "KEYWORD";
public static final String LABEL = "LABEL";
@ -77,26 +91,52 @@ public class HighlightRegionType {
public static final String LITERAL_STRING = "LITERAL_STRING";
public static final String LOCAL_VARIABLE = "LOCAL_VARIABLE";
public static final String LOCAL_FUNCTION_DECLARATION = "LOCAL_FUNCTION_DECLARATION";
public static final String LOCAL_FUNCTION_REFERENCE = "LOCAL_FUNCTION_REFERENCE";
public static final String LOCAL_VARIABLE_DECLARATION = "LOCAL_VARIABLE_DECLARATION";
public static final String METHOD = "METHOD";
public static final String LOCAL_VARIABLE_REFERENCE = "LOCAL_VARIABLE_REFERENCE";
public static final String METHOD_DECLARATION = "METHOD_DECLARATION";
public static final String PARAMETER_DECLARATION = "PARAMETER_DECLARATION";
public static final String METHOD_DECLARATION_STATIC = "METHOD_DECLARATION_STATIC";
public static final String PARAMETER_REFERENCE = "PARAMETER_REFERENCE";
public static final String METHOD_STATIC = "METHOD_STATIC";
public static final String STATIC_FIELD_DECLARATION = "STATIC_FIELD_DECLARATION";
public static final String PARAMETER = "PARAMETER";
public static final String STATIC_GETTER_DECLARATION = "STATIC_GETTER_DECLARATION";
public static final String SETTER_DECLARATION = "SETTER_DECLARATION";
public static final String STATIC_GETTER_REFERENCE = "STATIC_GETTER_REFERENCE";
public static final String TOP_LEVEL_VARIABLE = "TOP_LEVEL_VARIABLE";
public static final String STATIC_METHOD_DECLARATION = "STATIC_METHOD_DECLARATION";
public static final String STATIC_METHOD_REFERENCE = "STATIC_METHOD_REFERENCE";
public static final String STATIC_SETTER_DECLARATION = "STATIC_SETTER_DECLARATION";
public static final String STATIC_SETTER_REFERENCE = "STATIC_SETTER_REFERENCE";
public static final String TOP_LEVEL_FUNCTION_DECLARATION = "TOP_LEVEL_FUNCTION_DECLARATION";
public static final String TOP_LEVEL_FUNCTION_REFERENCE = "TOP_LEVEL_FUNCTION_REFERENCE";
public static final String TOP_LEVEL_GETTER_DECLARATION = "TOP_LEVEL_GETTER_DECLARATION";
public static final String TOP_LEVEL_GETTER_REFERENCE = "TOP_LEVEL_GETTER_REFERENCE";
public static final String TOP_LEVEL_SETTER_DECLARATION = "TOP_LEVEL_SETTER_DECLARATION";
public static final String TOP_LEVEL_SETTER_REFERENCE = "TOP_LEVEL_SETTER_REFERENCE";
public static final String TOP_LEVEL_VARIABLE_DECLARATION = "TOP_LEVEL_VARIABLE_DECLARATION";
public static final String TYPE_NAME_DYNAMIC = "TYPE_NAME_DYNAMIC";
public static final String TYPE_PARAMETER = "TYPE_PARAMETER";
public static final String UNRESOLVED_INSTANCE_MEMBER_REFERENCE = "UNRESOLVED_INSTANCE_MEMBER_REFERENCE";
public static final String VALID_STRING_ESCAPE = "VALID_STRING_ESCAPE";
}

View file

@ -5,7 +5,7 @@
</head>
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version <version>1.7.0</version></h1>
<h1 style="color:#999999">Version <version>2.0.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
@ -2494,17 +2494,24 @@
<value><code>COMMENT_END_OF_LINE</code></value>
<value><code>CONSTRUCTOR</code></value>
<value><code>DIRECTIVE</code></value>
<value><code>DYNAMIC_TYPE</code></value>
<value><code>DYNAMIC_LOCAL_VARIABLE_DECLARATION</code></value>
<value><code>DYNAMIC_LOCAL_VARIABLE_REFERENCE</code></value>
<value><code>DYNAMIC_PARAMETER_DECLARATION</code></value>
<value><code>DYNAMIC_PARAMETER_REFERENCE</code></value>
<value><code>ENUM</code></value>
<value><code>ENUM_CONSTANT</code></value>
<value><code>FIELD</code></value>
<value><code>FIELD_STATIC</code></value>
<value><code>FUNCTION</code></value>
<value><code>FUNCTION_DECLARATION</code></value>
<value><code>FUNCTION_TYPE_ALIAS</code></value>
<value><code>GETTER_DECLARATION</code></value>
<value><code>IDENTIFIER_DEFAULT</code></value>
<value><code>IMPORT_PREFIX</code></value>
<value><code>INSTANCE_FIELD_DECLARATION</code></value>
<value><code>INSTANCE_FIELD_REFERENCE</code></value>
<value><code>INSTANCE_GETTER_DECLARATION</code></value>
<value><code>INSTANCE_GETTER_REFERENCE</code></value>
<value><code>INSTANCE_METHOD_DECLARATION</code></value>
<value><code>INSTANCE_METHOD_REFERENCE</code></value>
<value><code>INSTANCE_SETTER_DECLARATION</code></value>
<value><code>INSTANCE_SETTER_REFERENCE</code></value>
<value><code>INVALID_STRING_ESCAPE</code></value>
<value><code>KEYWORD</code></value>
<value><code>LABEL</code></value>
<value><code>LITERAL_BOOLEAN</code></value>
@ -2513,17 +2520,30 @@
<value><code>LITERAL_LIST</code></value>
<value><code>LITERAL_MAP</code></value>
<value><code>LITERAL_STRING</code></value>
<value><code>LOCAL_VARIABLE</code></value>
<value><code>LOCAL_FUNCTION_DECLARATION</code></value>
<value><code>LOCAL_FUNCTION_REFERENCE</code></value>
<value><code>LOCAL_VARIABLE_DECLARATION</code></value>
<value><code>METHOD</code></value>
<value><code>METHOD_DECLARATION</code></value>
<value><code>METHOD_DECLARATION_STATIC</code></value>
<value><code>METHOD_STATIC</code></value>
<value><code>PARAMETER</code></value>
<value><code>SETTER_DECLARATION</code></value>
<value><code>TOP_LEVEL_VARIABLE</code></value>
<value><code>LOCAL_VARIABLE_REFERENCE</code></value>
<value><code>PARAMETER_DECLARATION</code></value>
<value><code>PARAMETER_REFERENCE</code></value>
<value><code>STATIC_FIELD_DECLARATION</code></value>
<value><code>STATIC_GETTER_DECLARATION</code></value>
<value><code>STATIC_GETTER_REFERENCE</code></value>
<value><code>STATIC_METHOD_DECLARATION</code></value>
<value><code>STATIC_METHOD_REFERENCE</code></value>
<value><code>STATIC_SETTER_DECLARATION</code></value>
<value><code>STATIC_SETTER_REFERENCE</code></value>
<value><code>TOP_LEVEL_FUNCTION_DECLARATION</code></value>
<value><code>TOP_LEVEL_FUNCTION_REFERENCE</code></value>
<value><code>TOP_LEVEL_GETTER_DECLARATION</code></value>
<value><code>TOP_LEVEL_GETTER_REFERENCE</code></value>
<value><code>TOP_LEVEL_SETTER_DECLARATION</code></value>
<value><code>TOP_LEVEL_SETTER_REFERENCE</code></value>
<value><code>TOP_LEVEL_VARIABLE_DECLARATION</code></value>
<value><code>TYPE_NAME_DYNAMIC</code></value>
<value><code>TYPE_PARAMETER</code></value>
<value><code>UNRESOLVED_INSTANCE_MEMBER_REFERENCE</code></value>
<value><code>VALID_STRING_ESCAPE</code></value>
</enum>
</type>
<type name="HoverInformation">