Skip to content

Commit 3100a1c

Browse files
committed
Merge pull request dart-archive/yaml#16 from dart-lang/ddc
fixes dart-lang/yaml#15, strong mode errors
2 parents 1786f59 + f36e14a commit 3100a1c

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

pkgs/yaml/lib/src/loader.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Loader {
127127
throw new YamlException("Invalid tag for sequence.", firstEvent.span);
128128
}
129129

130-
var children = [];
130+
var children = <YamlNode>[];
131131
var node = new YamlList.internal(
132132
children, firstEvent.span, firstEvent.style);
133133
_registerAnchor(firstEvent.anchor, node);

pkgs/yaml/lib/src/scanner.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ class Scanner {
443443
var token = _tokens.last;
444444
if (token.type == TokenType.FLOW_SEQUENCE_END ||
445445
token.type == TokenType.FLOW_MAPPING_END ||
446-
(token.type == TokenType.SCALAR && token.style.isQuoted)) {
446+
(token.type == TokenType.SCALAR &&
447+
(token as ScalarToken).style.isQuoted)) {
447448
_fetchValue();
448449
return;
449450
}

pkgs/yaml/lib/yaml.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,17 @@ YamlDocument loadYamlDocument(String yaml, {sourceUrl}) {
8181
YamlList loadYamlStream(String yaml, {sourceUrl}) {
8282
var loader = new Loader(yaml, sourceUrl: sourceUrl);
8383

84-
var documents = [];
84+
var documents = <YamlDocument>[];
8585
var document = loader.load();
8686
while (document != null) {
8787
documents.add(document);
8888
document = loader.load();
8989
}
9090

91+
// TODO(jmesserly): the type on the `document` parameter is a workaround for:
92+
// https://github.com/dart-lang/dev_compiler/issues/203
9193
return new YamlList.internal(
92-
documents.map((document) => document.contents).toList(),
94+
documents.map((YamlDocument document) => document.contents).toList(),
9395
loader.span,
9496
CollectionStyle.ANY);
9597
}
@@ -101,7 +103,7 @@ YamlList loadYamlStream(String yaml, {sourceUrl}) {
101103
List<YamlDocument> loadYamlDocuments(String yaml, {sourceUrl}) {
102104
var loader = new Loader(yaml, sourceUrl: sourceUrl);
103105

104-
var documents = [];
106+
var documents = <YamlDocument>[];
105107
var document = loader.load();
106108
while (document != null) {
107109
documents.add(document);

pkgs/yaml/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: yaml
2-
version: 2.1.7-dev
2+
version: 2.1.7
33
author: "Dart Team <[email protected]>"
44
homepage: https://github.com/dart-lang/yaml
55
description: A parser for YAML.

0 commit comments

Comments
 (0)