| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.generated.gn; | 5 library analyzer.src.generated.gn; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:core'; | 8 import 'dart:core'; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| 11 import 'package:analyzer/src/generated/sdk.dart'; | 11 import 'package:analyzer/src/generated/sdk.dart'; |
| 12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 13 import 'package:analyzer/src/generated/source_io.dart'; | 13 import 'package:analyzer/src/generated/source_io.dart'; |
| 14 import 'package:analyzer/src/generated/workspace.dart'; | 14 import 'package:analyzer/src/generated/workspace.dart'; |
| 15 import 'package:analyzer/src/util/fast_uri.dart'; | |
| 16 import 'package:path/path.dart'; | 15 import 'package:path/path.dart'; |
| 17 | 16 |
| 18 /** | 17 /** |
| 19 * The [UriResolver] used to resolve `file` URIs in a [GnWorkspace]. | 18 * The [UriResolver] used to resolve `file` URIs in a [GnWorkspace]. |
| 20 */ | 19 */ |
| 21 class GnFileUriResolver extends ResourceUriResolver { | 20 class GnFileUriResolver extends ResourceUriResolver { |
| 22 /** | 21 /** |
| 23 * The workspace associated with this resolver. | 22 * The workspace associated with this resolver. |
| 24 */ | 23 */ |
| 25 final GnWorkspace workspace; | 24 final GnWorkspace workspace; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 String package = _packages.keys.firstWhere( | 119 String package = _packages.keys.firstWhere( |
| 121 (key) => context.isWithin(_packages[key], path), | 120 (key) => context.isWithin(_packages[key], path), |
| 122 orElse: () => null); | 121 orElse: () => null); |
| 123 | 122 |
| 124 if (package == null) { | 123 if (package == null) { |
| 125 return null; | 124 return null; |
| 126 } | 125 } |
| 127 | 126 |
| 128 String sourcePath = context.relative(path, from: _packages[package]); | 127 String sourcePath = context.relative(path, from: _packages[package]); |
| 129 | 128 |
| 130 return FastUri.parse('package:$package/$sourcePath'); | 129 return Uri.parse('package:$package/$sourcePath'); |
| 131 } | 130 } |
| 132 } | 131 } |
| 133 | 132 |
| 134 /** | 133 /** |
| 135 * Information about a Gn workspace. | 134 * Information about a Gn workspace. |
| 136 */ | 135 */ |
| 137 class GnWorkspace extends Workspace { | 136 class GnWorkspace extends Workspace { |
| 138 /** | 137 /** |
| 139 * The name of the directory that identifies the root of the workspace. | 138 * The name of the directory that identifies the root of the workspace. |
| 140 */ | 139 */ |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 String outDirectory = _getOutDirectory(provider, root); | 259 String outDirectory = _getOutDirectory(provider, root); |
| 261 Map<String, String> packages = _getPackages(provider, outDirectory); | 260 Map<String, String> packages = _getPackages(provider, outDirectory); |
| 262 return new GnWorkspace._(provider, root, packages); | 261 return new GnWorkspace._(provider, root, packages); |
| 263 } | 262 } |
| 264 | 263 |
| 265 // Go up the folder. | 264 // Go up the folder. |
| 266 folder = parent; | 265 folder = parent; |
| 267 } | 266 } |
| 268 } | 267 } |
| 269 } | 268 } |
| OLD | NEW |