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

Unified Diff: pkg/yaml/lib/yaml.dart

Issue 401753002: Move a number of packages and some of pub over to using source_span. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/yaml/lib/src/yaml_node_wrapper.dart ('k') | pkg/yaml/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/yaml/lib/yaml.dart
diff --git a/pkg/yaml/lib/yaml.dart b/pkg/yaml/lib/yaml.dart
index 0afc2cc8ea0c72b547a00d3b5761d034b5c4e244..e45dd6ebedcb7ab21b29f720c493dbb281686a9d 100644
--- a/pkg/yaml/lib/yaml.dart
+++ b/pkg/yaml/lib/yaml.dart
@@ -29,18 +29,18 @@ export 'src/yaml_node.dart';
/// In future versions, maps will instead be [HashMap]s with a custom equality
/// operation.
///
-/// If [sourceName] is passed, it's used as the name of the file or URL from
-/// which the YAML originated for error reporting.
-loadYaml(String yaml, {String sourceName}) =>
- loadYamlNode(yaml, sourceName: sourceName).value;
+/// If [sourceUrl] is passed, it's used as the URL from which the YAML
+/// originated for error reporting. It can be a [String], a [Uri], or `null`.
+loadYaml(String yaml, {sourceUrl}) =>
+ loadYamlNode(yaml, sourceUrl: sourceUrl).value;
/// Loads a single document from a YAML string as a [YamlNode].
///
/// This is just like [loadYaml], except that where [loadYaml] would return a
/// normal Dart value this returns a [YamlNode] instead. This allows the caller
/// to be confident that the return value will always be a [YamlNode].
-YamlNode loadYamlNode(String yaml, {String sourceName}) {
- var stream = loadYamlStream(yaml, sourceName: sourceName);
+YamlNode loadYamlNode(String yaml, {sourceUrl}) {
+ var stream = loadYamlStream(yaml, sourceUrl: sourceUrl);
if (stream.length != 1) {
throw new YamlException("Expected 1 document, were ${stream.length}.",
stream.span);
@@ -59,12 +59,12 @@ YamlNode loadYamlNode(String yaml, {String sourceName}) {
/// In future versions, maps will instead be [HashMap]s with a custom equality
/// operation.
///
-/// If [sourceName] is passed, it's used as the name of the file or URL from
-/// which the YAML originated for error reporting.
-YamlList loadYamlStream(String yaml, {String sourceName}) {
+/// If [sourceUrl] is passed, it's used as the URL from which the YAML
+/// originated for error reporting. It can be a [String], a [Uri], or `null`.
+YamlList loadYamlStream(String yaml, {sourceUrl}) {
var pair;
try {
- pair = new Parser(yaml, sourceName).l_yamlStream();
+ pair = new Parser(yaml, sourceUrl).l_yamlStream();
} on StringScannerException catch (error) {
throw new YamlException(error.message, error.span);
}
« no previous file with comments | « pkg/yaml/lib/src/yaml_node_wrapper.dart ('k') | pkg/yaml/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698