Remove upper case constants (#27)
* Remove usage of upper-case constants.
* update SDK version
* remove stable from Travis config
diff --git a/.travis.yml b/.travis.yml
index 25aeabe..a49fc6f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,8 +2,6 @@
dart:
- dev
- - stable
-
dart_task:
- test: -p vm,chrome
- dartanalyzer
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8ef25be..9a0879c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@
## 0.10.4
* Implement `highlight` in `SourceMapFileSpan`.
* Require version `^1.3.0` of `source_span`.
+* Require version 2.0.0 of the Dart SDK.
## 0.10.3
* Add `addMapping` and `containsMapping` members to `MappingBundle`.
diff --git a/lib/builder.dart b/lib/builder.dart
index cdba2d2..0769d50 100644
--- a/lib/builder.dart
+++ b/lib/builder.dart
@@ -55,7 +55,7 @@
}
/// Encodes all mappings added to this builder as a json string.
- String toJson(String fileUrl) => JSON.encode(build(fileUrl));
+ String toJson(String fileUrl) => jsonEncode(build(fileUrl));
}
/// An entry in the source map builder.
diff --git a/lib/parser.dart b/lib/parser.dart
index e46b783..a500b13 100644
--- a/lib/parser.dart
+++ b/lib/parser.dart
@@ -24,7 +24,7 @@
// TODO(tjblasi): Ignore the first line of [jsonMap] if the JSON safety string
// `)]}'` begins the string representation of the map.
Mapping parse(String jsonMap, {Map<String, Map> otherMaps, mapUrl}) =>
- parseJson(JSON.decode(jsonMap), otherMaps: otherMaps, mapUrl: mapUrl);
+ parseJson(jsonDecode(jsonMap), otherMaps: otherMaps, mapUrl: mapUrl);
/// Parses a source map or source map bundle directly from a json string.
///
@@ -32,7 +32,7 @@
/// the source map file itself. If it's passed, any URLs in the source
/// map will be interpreted as relative to this URL when generating spans.
Mapping parseExtended(String jsonMap, {Map<String, Map> otherMaps, mapUrl}) =>
- parseJsonExtended(JSON.decode(jsonMap),
+ parseJsonExtended(jsonDecode(jsonMap),
otherMaps: otherMaps, mapUrl: mapUrl);
/// Parses a source map or source map bundle.
diff --git a/pubspec.yaml b/pubspec.yaml
index 7bf7bcd..8598aef 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -6,6 +6,6 @@
dependencies:
source_span: ^1.3.0
environment:
- sdk: '>=1.8.0 <2.0.0'
+ sdk: '>=2.0.0-dev.17.0 <2.0.0'
dev_dependencies:
test: '>=0.12.0 <0.13.0'
diff --git a/test/builder_test.dart b/test/builder_test.dart
index 7c27e4e..1e2efdd 100644
--- a/test/builder_test.dart
+++ b/test/builder_test.dart
@@ -27,6 +27,6 @@
..addLocation(inputVar2.start, outputVar2.start, 'longVar2')
..addLocation(inputExpr.start, outputExpr.start, null))
.toJson(output.url.toString());
- expect(str, JSON.encode(EXPECTED_MAP));
+ expect(str, jsonEncode(EXPECTED_MAP));
});
}
diff --git a/test/parser_test.dart b/test/parser_test.dart
index 7896341..398a40e 100644
--- a/test/parser_test.dart
+++ b/test/parser_test.dart
@@ -80,7 +80,7 @@
});
test('parse + json', () {
- var mapping = parse(JSON.encode(EXPECTED_MAP));
+ var mapping = parse(jsonEncode(EXPECTED_MAP));
check(outputVar1, mapping, inputVar1, false);
check(outputVar2, mapping, inputVar2, false);
check(outputFunction, mapping, inputFunction, false);
@@ -96,7 +96,7 @@
});
test('parse with no source location', () {
- SingleMapping map = parse(JSON.encode(MAP_WITH_NO_SOURCE_LOCATION));
+ SingleMapping map = parse(jsonEncode(MAP_WITH_NO_SOURCE_LOCATION));
expect(map.lines.length, 1);
expect(map.lines.first.entries.length, 1);
TargetEntry entry = map.lines.first.entries.first;
@@ -109,7 +109,7 @@
});
test('parse with source location and no name', () {
- SingleMapping map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION));
+ SingleMapping map = parse(jsonEncode(MAP_WITH_SOURCE_LOCATION));
expect(map.lines.length, 1);
expect(map.lines.first.entries.length, 1);
TargetEntry entry = map.lines.first.entries.first;
@@ -122,7 +122,7 @@
});
test('parse with source location and name', () {
- SingleMapping map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION_AND_NAME));
+ SingleMapping map = parse(jsonEncode(MAP_WITH_SOURCE_LOCATION_AND_NAME));
expect(map.lines.length, 1);
expect(map.lines.first.entries.length, 1);
TargetEntry entry = map.lines.first.entries.first;
@@ -251,7 +251,7 @@
});
test('parseExtended', () {
- var mapping = parseExtended(JSON.encode(SOURCE_MAP_BUNDLE),
+ var mapping = parseExtended(jsonEncode(SOURCE_MAP_BUNDLE),
mapUrl: "file:///path/to/map");
expect(mapping.spanFor(0, 0, uri: "output.dart").sourceUrl,
diff --git a/test/printer_test.dart b/test/printer_test.dart
index 3fd768d..32db695 100644
--- a/test/printer_test.dart
+++ b/test/printer_test.dart
@@ -24,7 +24,7 @@
..mark(inputExpr)
..add('x + y;\n');
expect(printer.text, OUTPUT);
- expect(printer.map, JSON.encode(EXPECTED_MAP));
+ expect(printer.map, jsonEncode(EXPECTED_MAP));
});
test('printer projecting marks', () {
@@ -93,7 +93,7 @@
..add('x + y;\n', span: inputExpr)
..build('output.dart');
expect(printer.text, OUTPUT);
- expect(printer.map, JSON.encode(EXPECTED_MAP));
+ expect(printer.map, jsonEncode(EXPECTED_MAP));
});
test('nested use', () {
@@ -106,7 +106,7 @@
..add('x + y;\n', span: inputExpr)
..build('output.dart');
expect(printer.text, OUTPUT);
- expect(printer.map, JSON.encode(EXPECTED_MAP));
+ expect(printer.map, jsonEncode(EXPECTED_MAP));
});
test('add indentation', () {