mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
* chore(deps): Add pretter-plugin-organize-imports * chore: Remove insignificant blank lines in import sections Since prettier-plugin-organize-imports sorts imports within sections separated by blank lines, but preserves the section divisions, remove any blank lines that are not dividing imports into meaningful sections. Do not remove blank lines separating side-effect-only imports from main imports. * chore: Remove unneded eslint-disable directives * chore: Organise imports
33 lines
860 B
TypeScript
33 lines
860 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2015 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @file Generating PHP for variable blocks.
|
|
*/
|
|
|
|
// Former goog.module ID: Blockly.PHP.variables
|
|
|
|
import type {Block} from '../../core/block.js';
|
|
import type {PhpGenerator} from './php_generator.js';
|
|
import {Order} from './php_generator.js';
|
|
|
|
export function variables_get(
|
|
block: Block,
|
|
generator: PhpGenerator,
|
|
): [string, Order] {
|
|
// Variable getter.
|
|
const code = generator.getVariableName(block.getFieldValue('VAR'));
|
|
return [code, Order.ATOMIC];
|
|
}
|
|
|
|
export function variables_set(block: Block, generator: PhpGenerator) {
|
|
// Variable setter.
|
|
const argument0 =
|
|
generator.valueToCode(block, 'VALUE', Order.ASSIGNMENT) || '0';
|
|
const varName = generator.getVariableName(block.getFieldValue('VAR'));
|
|
return varName + ' = ' + argument0 + ';\n';
|
|
}
|