Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Loader {
throw new YamlException("Invalid tag for sequence.", firstEvent.span);
}

var children = [];
var children = <YamlNode>[];
var node = new YamlList.internal(
children, firstEvent.span, firstEvent.style);
_registerAnchor(firstEvent.anchor, node);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ class Scanner {
var token = _tokens.last;
if (token.type == TokenType.FLOW_SEQUENCE_END ||
token.type == TokenType.FLOW_MAPPING_END ||
(token.type == TokenType.SCALAR && token.style.isQuoted)) {
(token.type == TokenType.SCALAR &&
(token as ScalarToken).style.isQuoted)) {
_fetchValue();
return;
}
Expand Down
8 changes: 5 additions & 3 deletions lib/yaml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,17 @@ YamlDocument loadYamlDocument(String yaml, {sourceUrl}) {
YamlList loadYamlStream(String yaml, {sourceUrl}) {
var loader = new Loader(yaml, sourceUrl: sourceUrl);

var documents = [];
var documents = <YamlDocument>[];
var document = loader.load();
while (document != null) {
documents.add(document);
document = loader.load();
}

// TODO(jmesserly): the type on the `document` parameter is a workaround for:
// https://github.com/dart-lang/dev_compiler/issues/203
return new YamlList.internal(
documents.map((document) => document.contents).toList(),
documents.map((YamlDocument document) => document.contents).toList(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a TODO to get rid of this.

loader.span,
CollectionStyle.ANY);
}
Expand All @@ -101,7 +103,7 @@ YamlList loadYamlStream(String yaml, {sourceUrl}) {
List<YamlDocument> loadYamlDocuments(String yaml, {sourceUrl}) {
var loader = new Loader(yaml, sourceUrl: sourceUrl);

var documents = [];
var documents = <YamlDocument>[];
var document = loader.load();
while (document != null) {
documents.add(document);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: yaml
version: 2.1.7-dev
version: 2.1.7
author: "Dart Team <[email protected]>"
homepage: https://github.com/dart-lang/yaml
description: A parser for YAML.
Expand Down