This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Don't use sync*, as it is unimplemented in dart2wasm. #38149
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT | ||
// | ||
// This file is auto generated by flutter/engine:flutter/tools/gen_web_keyboard_layouts based on | ||
// https://github.com/microsoft/vscode/tree/ab7ccc9e872dfcdfc429f8f2815109ec0ca926e3/src/vs/workbench/services/keybinding/browser/keyboardLayouts | ||
// https://github.com/microsoft/vscode/tree/422b581e3802e30cfb780c21d9cc1a2cd0c9f0aa/src/vs/workbench/services/keybinding/browser/keyboardLayouts | ||
// | ||
// Edit the following files instead: | ||
// | ||
|
@@ -100,16 +100,17 @@ bool isLetter(int charCode) { | |
/// | ||
/// This greatly reduces the entries needed in the final mapping. | ||
int? heuristicMapper(String code, String key) { | ||
// Digit code: return the digit. | ||
// Digit code: return the digit by event code. | ||
if (code.startsWith('Digit')) { | ||
assert(code.length == 6); | ||
return code.codeUnitAt(5); // The character immediately after 'Digit' | ||
} | ||
final int charCode = key.codeUnitAt(0); | ||
// Non-ascii: return the goal (i.e. US mapping by event code). | ||
if (key.length > 1 || !_isAscii(charCode)) { | ||
return kLayoutGoals[code]?.codeUnitAt(0); | ||
} | ||
// Letter key: return the letter. | ||
// Letter key: return the event key letter. | ||
if (isLetter(charCode)) { | ||
return key.toLowerCase().codeUnitAt(0); | ||
} | ||
|
@@ -167,22 +168,20 @@ class _StringStream { | |
|
||
Map<String, int> _unmarshallCodeMap(_StringStream stream) { | ||
final int entryNum = stream.readIntAsVerbatim(); | ||
return Map<String, int>.fromEntries((() sync* { | ||
for (int entryIndex = 0; entryIndex < entryNum; entryIndex += 1) { | ||
yield MapEntry<String, int>(stream.readEventKey(), stream.readIntAsChar()); | ||
} | ||
})()); | ||
return Map<String, int>.fromEntries( | ||
Iterable<int>.generate(entryNum).map((final int index) => | ||
MapEntry<String, int>(stream.readEventKey(), stream.readIntAsChar()) | ||
)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we're looking for performance, this would probably be even faster (you'd have to benchmark it to be sure) if we used a regular c-style There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could/should use collection literal syntax, here! return <String, int>{
for (var i = 0; i < entryNum; i++)
stream.readEventKey() : stream.readIntAsChar(),
}; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I never thought it could be done this clean! |
||
} | ||
|
||
/// Decode a key mapping data out of the string. | ||
Map<String, Map<String, int>> unmarshallMappingData(String compressed) { | ||
final _StringStream stream = _StringStream(compressed); | ||
final int eventCodeNum = stream.readIntAsVerbatim(); | ||
return Map<String, Map<String, int>>.fromEntries((() sync* { | ||
for (int eventCodeIndex = 0; eventCodeIndex < eventCodeNum; eventCodeIndex += 1) { | ||
yield MapEntry<String, Map<String, int>>(stream.readEventCode(), _unmarshallCodeMap(stream)); | ||
} | ||
})()); | ||
return Map<String, Map<String, int>>.fromEntries( | ||
Iterable<int>.generate(eventCodeNum).map((final int index) => | ||
MapEntry<String, Map<String, int>>(stream.readEventCode(), _unmarshallCodeMap(stream)) | ||
)); | ||
} | ||
|
||
/// Data for [LocaleKeymap] on Windows. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help me fix this line by changing gen_web_keyboard_layouts to gen_web_locale_keymap? It was using the old library name. Make sure to change the tmpl too.