Skip to content

Commit c25b75f

Browse files
committed
Version 1.12.0-dev.3.0
Merge commit '10b7db100ffec216aa09d1d7816f1c59677eb70b' into dev
2 parents 58c6967 + 10b7db1 commit c25b75f

File tree

301 files changed

+8052
-3256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+8052
-3256
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* Added two new file modes, `WRITE_ONLY` and `WRITE_ONLY_APPEND` for
1313
opening a file write only.
1414
[eaeecf2](https://github.com/dart-lang/sdk/commit/eaeecf2ed13ba6c7fbfd653c3c592974a7120960)
15+
* Change stdout/stderr to binary mode on Windows.
16+
[4205b29](https://github.com/dart-lang/sdk/commit/4205b2997e01f2cea8e2f44c6f46ed6259ab7277)
1517

1618
### Tool changes
1719

@@ -27,6 +29,15 @@
2729
* `pub run` starts up faster for executables that don't import transformed
2830
code.
2931

32+
* An issue where HTTP requests were sometimes made even though `--offline` was
33+
passed to `pub get` or `pub upgrade` has been fixed.
34+
35+
* A bug with `--offline` that caused an unhelpful error message has been
36+
fixed.
37+
38+
* A crashing bug involving transformers that only apply to non-public code has
39+
been fixed.
40+
3041
[package spec proposal]: https://github.com/lrhn/dep-pkgspec
3142

3243
## 1.11.1

DEPS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ vars = {
3838

3939
# Revisions of /third_party/* dependencies.
4040
"7zip_rev" : "@19997",
41-
"analyzer_cli_rev" : "@8bf3516dd645ca289d7ebc641f7c228d5b3d37c4",
41+
"analyzer_cli_rev" : "@5069b75f6ccef59b2ba4e2c382bc000037290125",
4242
"args_tag": "@0.13.0",
4343
"async_tag": "@1.2.0",
4444
"barback_rev" : "@29ee90dbcf77cfd64632fa2797a4c8a4f29a4b51",
@@ -49,7 +49,7 @@ vars = {
4949
"collection_rev": "@1da9a07f32efa2ba0c391b289e2037391e31da0e",
5050
"crypto_rev" : "@2df57a1e26dd88e8d0614207d4b062c73209917d",
5151
"csslib_tag" : "@0.12.0",
52-
"dartdoc_rev" : "@9f677ec40f9beeb8933374885ef3af4c63d35d25",
52+
"dartdoc_tag" : "@v0.0.3",
5353
"dart_services_rev" : "@7aea2574e6f3924bf409a80afb8ad52aa2be4f97",
5454
"dart_style_tag": "@0.1.8+1",
5555
"dev_compiler_rev": "@0.1.1",
@@ -79,12 +79,12 @@ vars = {
7979
"observe_rev": "@eee2b8ec34236fa46982575fbccff84f61202ac6",
8080
"observatory_pub_packages_rev": "@45565",
8181
"package_config_tag": "@0.1.1",
82-
"path_rev": "@93b3e2aa1db0ac0c8bab9d341588d77acda60320",
82+
"path_tag": "@1.3.6",
8383
"petitparser_rev" : "@37878",
8484
"ply_rev": "@604b32590ffad5cbb82e4afef1d305512d06ae93",
8585
"plugin_tag": "@0.1.0",
8686
"pool_rev": "@e454b4b54d2987e8d2f0fbd3ac519641ada9bd0f",
87-
"pub_rev": "@e05cfca67574acfdbce55a8422c6bc458be93d10",
87+
"pub_rev": "@072c5d85f4741bd4eede3eb8d309669b887e3c54",
8888
"pub_cache_tag": "@v0.0.1+2",
8989
"pub_semver_tag": "@1.2.1",
9090
"quiver_tag": "@0.21.4",
@@ -199,7 +199,7 @@ deps = {
199199
Var("dart_root") + "/third_party/pkg_tested/dart_style":
200200
(Var("github_mirror") % "dart_style") + Var("dart_style_tag"),
201201
Var("dart_root") + "/third_party/pkg/dartdoc":
202-
"https://github.com/dart-lang/dartdoc.git" + Var("dartdoc_rev"),
202+
"https://github.com/dart-lang/dartdoc.git" + Var("dartdoc_tag"),
203203
Var("dart_root") + "/third_party/pkg/dev_compiler":
204204
"https://github.com/dart-lang/dev_compiler.git" + Var("dev_compiler_rev"),
205205
Var("dart_root") + "/third_party/pkg/glob":
@@ -245,7 +245,7 @@ deps = {
245245
(Var("github_mirror") % "package_config") +
246246
Var("package_config_tag"),
247247
Var("dart_root") + "/third_party/pkg/path":
248-
(Var("github_mirror") % "path") + Var("path_rev"),
248+
(Var("github_mirror") % "path") + Var("path_tag"),
249249
Var("dart_root") + "/third_party/pkg/plugin":
250250
(Var("github_mirror") % "plugin") + Var("plugin_tag"),
251251
Var("dart_root") + "/third_party/pkg/pool":

pkg/analysis_server/doc/api.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,13 @@ <h4>Returns</h4><dl><dt class="field"><b><i>libraries ( List&lt;<a href="#type_F
555555
always choosing a region that starts at the beginning of a line and
556556
ends at the end of a (possibly different) line in the file.
557557
</p>
558+
<p>
559+
If a request is made for a file which does not exist, or
560+
which is not currently subject to analysis (e.g. because it
561+
is not associated with any analysis root specified to
562+
analysis.setAnalysisRoots), an error of type
563+
<tt>GET_NAVIGATION_INVALID_FILE</tt> will be generated.
564+
</p>
558565

559566

560567
<h4>Parameters</h4><dl><dt class="field"><b><i>file ( <a href="#type_FilePath">FilePath</a> )</i></b></dt><dd>
@@ -3156,6 +3163,13 @@ <h2 class="domain"><a name="types">Types</a></h2>
31563163
</p>
31573164
</dd><dt class="value">GET_ERRORS_INVALID_FILE</dt><dd>
31583165

3166+
<p>
3167+
An "analysis.getErrors" request specified a FilePath
3168+
which does not match a file currently subject to
3169+
analysis.
3170+
</p>
3171+
</dd><dt class="value">GET_NAVIGATION_INVALID_FILE</dt><dd>
3172+
31593173
<p>
31603174
An "analysis.getErrors" request specified a FilePath
31613175
which does not match a file currently subject to

pkg/analysis_server/lib/src/analysis_server.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import 'package:analysis_server/src/source/optimizing_pub_package_map_provider.d
2525
import 'package:analysis_server/uri/resolver_provider.dart';
2626
import 'package:analyzer/file_system/file_system.dart';
2727
import 'package:analyzer/instrumentation/instrumentation.dart';
28+
import 'package:analyzer/source/package_map_resolver.dart';
29+
import 'package:analyzer/source/sdk_ext.dart';
2830
import 'package:analyzer/src/generated/ast.dart';
2931
import 'package:analyzer/src/generated/element.dart';
3032
import 'package:analyzer/src/generated/engine.dart';
@@ -1429,9 +1431,17 @@ class ServerContextManager extends ContextManager {
14291431
SourceFactory _createSourceFactory(UriResolver packageUriResolver) {
14301432
UriResolver dartResolver = new DartUriResolver(analysisServer.defaultSdk);
14311433
UriResolver resourceResolver = new ResourceUriResolver(resourceProvider);
1432-
List<UriResolver> resolvers = packageUriResolver != null
1433-
? <UriResolver>[dartResolver, packageUriResolver, resourceResolver]
1434-
: <UriResolver>[dartResolver, resourceResolver];
1434+
List<UriResolver> resolvers = [];
1435+
resolvers.add(dartResolver);
1436+
if (packageUriResolver is PackageMapUriResolver) {
1437+
UriResolver sdkExtResolver =
1438+
new SdkExtUriResolver(packageUriResolver.packageMap);
1439+
resolvers.add(sdkExtResolver);
1440+
}
1441+
if (packageUriResolver != null) {
1442+
resolvers.add(packageUriResolver);
1443+
}
1444+
resolvers.add(resourceResolver);
14351445
return new SourceFactory(resolvers);
14361446
}
14371447
}

pkg/analysis_server/lib/src/computer/computer_navigation.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,17 @@ import 'package:analyzer/src/generated/source.dart';
1616
* A computer for navigation regions in a Dart [CompilationUnit].
1717
*/
1818
class DartUnitNavigationComputer {
19-
final CompilationUnit _unit;
20-
2119
final List<String> files = <String>[];
2220
final Map<String, int> fileMap = new HashMap<String, int>();
2321
final List<protocol.NavigationTarget> targets = <protocol.NavigationTarget>[];
2422
final Map<Element, int> targetMap = new HashMap<Element, int>();
2523
final List<protocol.NavigationRegion> regions = <protocol.NavigationRegion>[];
2624

27-
DartUnitNavigationComputer(this._unit);
28-
2925
/**
3026
* Computes [regions], [targets] and [files].
3127
*/
32-
void compute() {
33-
_unit.accept(new _DartUnitNavigationComputerVisitor(this));
28+
void compute(AstNode node) {
29+
node.accept(new _DartUnitNavigationComputerVisitor(this));
3430
}
3531

3632
int _addFile(String file) {

pkg/analysis_server/lib/src/constants.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const String ANALYSIS_GET_ERRORS = 'analysis.getErrors';
2525
const String ANALYSIS_GET_HOVER = 'analysis.getHover';
2626
const String ANALYSIS_GET_LIBRARY_DEPENDENCIES =
2727
'analysis.getLibraryDependencies';
28+
const String ANALYSIS_GET_NAVIGATION = 'analysis.getNavigation';
2829
const String ANALYSIS_REANALYZE = 'analysis.reanalyze';
2930
const String ANALYSIS_SET_ANALYSIS_ROOTS = 'analysis.setAnalysisRoots';
3031
const String ANALYSIS_SET_PRIORITY_FILES = 'analysis.setPriorityFiles';

pkg/analysis_server/lib/src/domain_analysis.dart

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'dart:core' hide Resource;
99

1010
import 'package:analysis_server/src/analysis_server.dart';
1111
import 'package:analysis_server/src/computer/computer_hover.dart';
12+
import 'package:analysis_server/src/computer/computer_navigation.dart';
1213
import 'package:analysis_server/src/constants.dart';
1314
import 'package:analysis_server/src/protocol_server.dart';
1415
import 'package:analysis_server/src/services/dependencies/library_dependencies.dart';
@@ -105,6 +106,52 @@ class AnalysisDomainHandler implements RequestHandler {
105106
return Response.DELAYED_RESPONSE;
106107
}
107108

109+
/**
110+
* Implement the `analysis.getNavigation` request.
111+
*/
112+
Response getNavigation(Request request) {
113+
var params = new AnalysisGetNavigationParams.fromRequest(request);
114+
String file = params.file;
115+
int offset = params.offset;
116+
Future<AnalysisDoneReason> completionFuture =
117+
server.onFileAnalysisComplete(file);
118+
if (completionFuture == null) {
119+
return new Response.getNavigationInvalidFile(request);
120+
}
121+
completionFuture.then((AnalysisDoneReason reason) {
122+
switch (reason) {
123+
case AnalysisDoneReason.COMPLETE:
124+
List<CompilationUnit> units =
125+
server.getResolvedCompilationUnits(file);
126+
if (units.isEmpty) {
127+
server.sendResponse(new Response.getNavigationInvalidFile(request));
128+
} else {
129+
DartUnitNavigationComputer computer =
130+
new DartUnitNavigationComputer();
131+
for (CompilationUnit unit in units) {
132+
AstNode node = new NodeLocator(offset).searchWithin(unit);
133+
if (node != null) {
134+
computer.compute(node);
135+
}
136+
}
137+
server.sendResponse(new AnalysisGetNavigationResult(
138+
computer.files, computer.targets, computer.regions)
139+
.toResponse(request.id));
140+
}
141+
break;
142+
case AnalysisDoneReason.CONTEXT_REMOVED:
143+
// The active contexts have changed, so try again.
144+
Response response = getNavigation(request);
145+
if (response != Response.DELAYED_RESPONSE) {
146+
server.sendResponse(response);
147+
}
148+
break;
149+
}
150+
});
151+
// delay response
152+
return Response.DELAYED_RESPONSE;
153+
}
154+
108155
@override
109156
Response handleRequest(Request request) {
110157
try {
@@ -115,6 +162,8 @@ class AnalysisDomainHandler implements RequestHandler {
115162
return getHover(request);
116163
} else if (requestName == ANALYSIS_GET_LIBRARY_DEPENDENCIES) {
117164
return getLibraryDependencies(request);
165+
} else if (requestName == ANALYSIS_GET_NAVIGATION) {
166+
return getNavigation(request);
118167
} else if (requestName == ANALYSIS_REANALYZE) {
119168
return reanalyze(request);
120169
} else if (requestName == ANALYSIS_SET_ANALYSIS_ROOTS) {

pkg/analysis_server/lib/src/generated_protocol.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12121,6 +12121,7 @@ class RequestError implements HasToJson {
1212112121
* FORMAT_INVALID_FILE
1212212122
* FORMAT_WITH_ERRORS
1212312123
* GET_ERRORS_INVALID_FILE
12124+
* GET_NAVIGATION_INVALID_FILE
1212412125
* INVALID_ANALYSIS_ROOT
1212512126
* INVALID_EXECUTION_CONTEXT
1212612127
* INVALID_OVERLAY_CHANGE
@@ -12163,6 +12164,12 @@ class RequestErrorCode implements Enum {
1216312164
*/
1216412165
static const GET_ERRORS_INVALID_FILE = const RequestErrorCode._("GET_ERRORS_INVALID_FILE");
1216512166

12167+
/**
12168+
* An "analysis.getErrors" request specified a FilePath which does not match
12169+
* a file currently subject to analysis.
12170+
*/
12171+
static const GET_NAVIGATION_INVALID_FILE = const RequestErrorCode._("GET_NAVIGATION_INVALID_FILE");
12172+
1216612173
/**
1216712174
* A path passed as an argument to a request (such as analysis.reanalyze) is
1216812175
* required to be an analysis root, but isn't.
@@ -12263,7 +12270,7 @@ class RequestErrorCode implements Enum {
1226312270
/**
1226412271
* A list containing all of the enum values that are defined.
1226512272
*/
12266-
static const List<RequestErrorCode> VALUES = const <RequestErrorCode>[CONTENT_MODIFIED, FORMAT_INVALID_FILE, FORMAT_WITH_ERRORS, GET_ERRORS_INVALID_FILE, INVALID_ANALYSIS_ROOT, INVALID_EXECUTION_CONTEXT, INVALID_OVERLAY_CHANGE, INVALID_PARAMETER, INVALID_REQUEST, NO_INDEX_GENERATED, REFACTORING_REQUEST_CANCELLED, SERVER_ALREADY_STARTED, SERVER_ERROR, SORT_MEMBERS_INVALID_FILE, SORT_MEMBERS_PARSE_ERRORS, UNANALYZED_PRIORITY_FILES, UNKNOWN_REQUEST, UNKNOWN_SOURCE, UNSUPPORTED_FEATURE];
12273+
static const List<RequestErrorCode> VALUES = const <RequestErrorCode>[CONTENT_MODIFIED, FORMAT_INVALID_FILE, FORMAT_WITH_ERRORS, GET_ERRORS_INVALID_FILE, GET_NAVIGATION_INVALID_FILE, INVALID_ANALYSIS_ROOT, INVALID_EXECUTION_CONTEXT, INVALID_OVERLAY_CHANGE, INVALID_PARAMETER, INVALID_REQUEST, NO_INDEX_GENERATED, REFACTORING_REQUEST_CANCELLED, SERVER_ALREADY_STARTED, SERVER_ERROR, SORT_MEMBERS_INVALID_FILE, SORT_MEMBERS_PARSE_ERRORS, UNANALYZED_PRIORITY_FILES, UNKNOWN_REQUEST, UNKNOWN_SOURCE, UNSUPPORTED_FEATURE];
1226712274

1226812275
final String name;
1226912276

@@ -12279,6 +12286,8 @@ class RequestErrorCode implements Enum {
1227912286
return FORMAT_WITH_ERRORS;
1228012287
case "GET_ERRORS_INVALID_FILE":
1228112288
return GET_ERRORS_INVALID_FILE;
12289+
case "GET_NAVIGATION_INVALID_FILE":
12290+
return GET_NAVIGATION_INVALID_FILE;
1228212291
case "INVALID_ANALYSIS_ROOT":
1228312292
return INVALID_ANALYSIS_ROOT;
1228412293
case "INVALID_EXECUTION_CONTEXT":

pkg/analysis_server/lib/src/operation/operation_analysis.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ void sendAnalysisNotificationHighlights(
133133
void sendAnalysisNotificationNavigation(
134134
AnalysisServer server, String file, CompilationUnit dartUnit) {
135135
_sendNotification(server, () {
136-
var computer = new DartUnitNavigationComputer(dartUnit);
137-
computer.compute();
136+
var computer = new DartUnitNavigationComputer();
137+
computer.compute(dartUnit);
138138
var params = new protocol.AnalysisNavigationParams(
139139
file, computer.regions, computer.targets, computer.files);
140140
server.sendNotification(params.toNotification());

pkg/analysis_server/lib/src/protocol.dart

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ class Request {
513513
: _params = params != null ? params : new HashMap<String, Object>();
514514

515515
/**
516-
* Return a request parsed from the given [data], or `null` if the [data] is
516+
* Return a request parsed from the given json, or `null` if the [data] is
517517
* not a valid json representation of a request. The [data] is expected to
518518
* have the following format:
519519
*
@@ -531,20 +531,26 @@ class Request {
531531
* The clientRequestTime must be an int representing the time at which
532532
* the client issued the request (milliseconds since epoch).
533533
*/
534-
factory Request.fromString(String data) {
535-
try {
536-
var result = JSON.decode(data);
537-
if (result is Map) {
538-
return new Request.fromJson(result);
539-
}
534+
factory Request.fromJson(Map<String, dynamic> result) {
535+
var id = result[Request.ID];
536+
var method = result[Request.METHOD];
537+
if (id is! String || method is! String) {
540538
return null;
541-
} catch (exception) {
539+
}
540+
var time = result[Request.CLIENT_REQUEST_TIME];
541+
if (time != null && time is! int) {
542+
return null;
543+
}
544+
var params = result[Request.PARAMS];
545+
if (params is Map || params == null) {
546+
return new Request(id, method, params, time);
547+
} else {
542548
return null;
543549
}
544550
}
545551

546552
/**
547-
* Return a request parsed from the given json, or `null` if the [data] is
553+
* Return a request parsed from the given [data], or `null` if the [data] is
548554
* not a valid json representation of a request. The [data] is expected to
549555
* have the following format:
550556
*
@@ -562,20 +568,14 @@ class Request {
562568
* The clientRequestTime must be an int representing the time at which
563569
* the client issued the request (milliseconds since epoch).
564570
*/
565-
factory Request.fromJson(Map<String, dynamic> result) {
566-
var id = result[Request.ID];
567-
var method = result[Request.METHOD];
568-
if (id is! String || method is! String) {
569-
return null;
570-
}
571-
var time = result[Request.CLIENT_REQUEST_TIME];
572-
if (time != null && time is! int) {
571+
factory Request.fromString(String data) {
572+
try {
573+
var result = JSON.decode(data);
574+
if (result is Map) {
575+
return new Request.fromJson(result);
576+
}
573577
return null;
574-
}
575-
var params = result[Request.PARAMS];
576-
if (params is Map || params == null) {
577-
return new Request(id, method, params, time);
578-
} else {
578+
} catch (exception) {
579579
return null;
580580
}
581581
}
@@ -762,6 +762,14 @@ class Response {
762762
error: new RequestError(RequestErrorCode.GET_ERRORS_INVALID_FILE,
763763
'Error during `analysis.getErrors`: invalid file.'));
764764

765+
/**
766+
* Initialize a newly created instance to represent the
767+
* GET_NAVIGATION_INVALID_FILE error condition.
768+
*/
769+
Response.getNavigationInvalidFile(Request request) : this(request.id,
770+
error: new RequestError(RequestErrorCode.GET_NAVIGATION_INVALID_FILE,
771+
'Error during `analysis.getNavigation`: invalid file.'));
772+
765773
/**
766774
* Initialize a newly created instance to represent an error condition caused
767775
* by an analysis.reanalyze [request] that specifies an analysis root that is

0 commit comments

Comments
 (0)