mirror of
https://github.com/google/blockly.git
synced 2026-03-14 09:10:09 +01:00
chore: Use ES6 template strings in CSS and code generators (#5902)
* Unindent CSS, save 3 kb of code. * Convert generator functions to template strings. This resolves #5761.
This commit is contained in:
@@ -70,16 +70,20 @@ Python['controls_for'] = function(block) {
|
||||
|
||||
// Helper functions.
|
||||
const defineUpRange = function() {
|
||||
return Python.provideFunction_('upRange', [
|
||||
'def ' + Python.FUNCTION_NAME_PLACEHOLDER_ + '(start, stop, step):',
|
||||
' while start <= stop:', ' yield start', ' start += abs(step)'
|
||||
]);
|
||||
return Python.provideFunction_('upRange', `
|
||||
def ${Python.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
|
||||
while start <= stop:
|
||||
yield start
|
||||
start += abs(step)
|
||||
`);
|
||||
};
|
||||
const defineDownRange = function() {
|
||||
return Python.provideFunction_('downRange', [
|
||||
'def ' + Python.FUNCTION_NAME_PLACEHOLDER_ + '(start, stop, step):',
|
||||
' while start >= stop:', ' yield start', ' start -= abs(step)'
|
||||
]);
|
||||
return Python.provideFunction_('downRange', `
|
||||
def ${Python.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
|
||||
while start >= stop:
|
||||
yield start
|
||||
start -= abs(step)
|
||||
`);
|
||||
};
|
||||
// Arguments are legal Python code (numbers or strings returned by scrub()).
|
||||
const generateUpDownRange = function(start, end, inc) {
|
||||
|
||||
Reference in New Issue
Block a user