fixes dart-lang/yaml#15, strong mode errors and warnings
diff --git a/pkgs/yaml/lib/src/loader.dart b/pkgs/yaml/lib/src/loader.dart index 82ae455..07ae430 100644 --- a/pkgs/yaml/lib/src/loader.dart +++ b/pkgs/yaml/lib/src/loader.dart
@@ -127,7 +127,7 @@ 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);
diff --git a/pkgs/yaml/lib/src/scanner.dart b/pkgs/yaml/lib/src/scanner.dart index 2e02a8f..0ac86dc 100644 --- a/pkgs/yaml/lib/src/scanner.dart +++ b/pkgs/yaml/lib/src/scanner.dart
@@ -443,7 +443,8 @@ 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; }
diff --git a/pkgs/yaml/lib/yaml.dart b/pkgs/yaml/lib/yaml.dart index aa120ef..0d48dea 100644 --- a/pkgs/yaml/lib/yaml.dart +++ b/pkgs/yaml/lib/yaml.dart
@@ -81,15 +81,17 @@ 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(), loader.span, CollectionStyle.ANY); } @@ -101,7 +103,7 @@ 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);
diff --git a/pkgs/yaml/pubspec.yaml b/pkgs/yaml/pubspec.yaml index 98f2e29..46b7475 100644 --- a/pkgs/yaml/pubspec.yaml +++ b/pkgs/yaml/pubspec.yaml
@@ -1,5 +1,5 @@ name: yaml -version: 2.1.7-dev +version: 2.1.7 author: "Dart Team <misc@dartlang.org>" homepage: https://github.com/dart-lang/yaml description: A parser for YAML.