Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to use Dart 2 core library lowercase constant names. #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog - chrome.dart

## 0.10.2 2018-07-13
- change core library constants to lowercase.

## 0.10.1 2018-05-02
- fix missing classes on generated `app.dart` file.

Expand Down Expand Up @@ -98,11 +101,11 @@

## 0.5.2 2014-02-14 (SDK 1.3.0-dev.3.2 r33495)

- Updated to use docgen for api documentation
- Updated to use docgen for api documentation
- Make the window close event sync instead of async
- Clean up warnings in unit tests
- Add app/ to drone_io.sh script
- Add a chrome pub transformer
- Add a chrome pub transformer
- Fix an issue w/ the hand-overridden API
- Use a getter to fetch the JsObject for an API each time it is needed

Expand Down
2 changes: 1 addition & 1 deletion lib/src/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ List listify(JsObject obj, [Function transformer = null]) {

Map mapify(JsObject obj) {
if (obj == null) return null;
return JSON.decode(_jsJSON.callMethod('stringify', [obj]));
return jsonDecode(_jsJSON.callMethod('stringify', [obj]));
}

dynamic jsify(dynamic obj) {
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: chrome
version: 0.10.1
version: 0.10.2
authors:
- Adam Bender <[email protected]>
- Ben Holtz <[email protected]>
- Ben Holtz <[email protected]>
description: A library for accessing the Chrome APIs in a packaged app or extension.
homepage: https://github.com/dart-gde/chrome.dart
environment:
Expand Down
2 changes: 1 addition & 1 deletion tool/lib/gen_apis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class GenApis {
void generate() {
_logger.info("reading ${apisFile.path}...");

var apisInfo = JSON.decode(apisFile.readAsStringSync());
var apisInfo = jsonDecode(apisFile.readAsStringSync());

_generateApi('app', apisInfo['packaged_app'], includeAppSrc: true);
_generateApi('ext', apisInfo['extension'], alreadyWritten: apisInfo['packaged_app']);
Expand Down
2 changes: 1 addition & 1 deletion tool/lib/json_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ JsonNamespace parse(String jsonText) {
}
});

return _parseJson(JSON.decode(newLines.join('\n')));
return _parseJson(jsonDecode(newLines.join('\n')));
}

JsonNamespace _parseJson(dynamic json) {
Expand Down
2 changes: 1 addition & 1 deletion tool/lib/overrides.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Overrides {
}

Overrides.fromFile(File file) {
_init(JSON.decode(file.readAsStringSync()));
_init(jsonDecode(file.readAsStringSync()));
}

void _init(Map m) {
Expand Down
3 changes: 2 additions & 1 deletion tool/src/googlesource.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ abstract class GoogleSourceEntity {
class GoogleSourceFile extends GoogleSourceEntity {
static const _encodedCharacters = const ['\'', '&', '<', '>', '\"'];
static final encodings =
new Map.fromIterable(_encodedCharacters, key: HTML_ESCAPE.convert);
new Map<String, String>.fromIterable(_encodedCharacters,
key: htmlEscape.convert);

GoogleSourceFile(rawHtml, url) : super(rawHtml, url);

Expand Down
2 changes: 1 addition & 1 deletion tool/src/simple_http_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class SimpleHttpClient {
HttpClientRequest request = await _client.getUrl(uri);
request.close();
HttpClientResponse response = await request.done;
return await response.transform(UTF8.decoder).join('');
return await response.transform(utf8.decoder).join('');
}
}
2 changes: 1 addition & 1 deletion tool/test/googlesource_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void defineTests() {
test('unescapes files', () {
var testEscapeString = 'this & that is <\"\'>';
var escapedHtmlFile = '<table><tr><td></td><td><a name="1"></a><span>'
'${HTML_ESCAPE.convert(testEscapeString)}</span></td></tr></table>';
'${htmlEscape.convert(testEscapeString)}</span></td></tr></table>';
file = new GoogleSourceFile(escapedHtmlFile, 'www.example.com');

expect(file.fileContents, testEscapeString);
Expand Down
10 changes: 5 additions & 5 deletions tool/test/model_json_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void main() {
"description": "A simple enum with two values",
"enum": ["firstVal", "secondVal"]
}]''';
var jsonEnum = json_model.JsonEnum.parse(JSON.decode(data)).single;
var jsonEnum = json_model.JsonEnum.parse(jsonDecode(data)).single;

expect(jsonEnum.name, 'simpleEnum');
expect(jsonEnum.values.length, 2);
Expand All @@ -98,7 +98,7 @@ void main() {
"description": "A very simple enum with one value",
"enum": ["onlyVal"]
}]''';
var jsonEnums = json_model.JsonEnum.parse(JSON.decode(data));
var jsonEnums = json_model.JsonEnum.parse(jsonDecode(data));

expect(jsonEnums.length, 2);
expect(jsonEnums[0].name, 'simpleEnum');
Expand All @@ -124,7 +124,7 @@ void main() {
"description": "A very simple enum with one value",
"enum": ["onlyVal"]
}]''';
var jsonEnums = json_model.JsonEnum.parse(JSON.decode(data));
var jsonEnums = json_model.JsonEnum.parse(jsonDecode(data));

expect(jsonEnums.length, 2);
expect(jsonEnums[0].name, 'simpleEnum');
Expand All @@ -147,7 +147,7 @@ void main() {
}
]
}]''';
var jsonEnum = json_model.JsonEnum.parse(JSON.decode(data)).single;
var jsonEnum = json_model.JsonEnum.parse(jsonDecode(data)).single;

expect(jsonEnum.name, 'describedEnum');
expect(jsonEnum.values.length, 2);
Expand Down Expand Up @@ -211,7 +211,7 @@ void main() {
}]""";

List<json_model.JsonFunction> functions =
json_model.JsonFunction.parse(JSON.decode(data));
json_model.JsonFunction.parse(jsonDecode(data));
expect(functions, isNotNull);
expect(functions, hasLength(1));
json_model.JsonFunction function = functions[0];
Expand Down