Skip to content

Conversation

@Jezzamonn
Copy link
Collaborator

Re-adds the goog.isDef, goog.isNull, goog.isDefAndNotNull, goog.isString, goog.isBoolean, goog.isNumber, and goog.isFunction functions as polyfills under the Blockly.goog namespace.

This change is necessary because these functions were removed from the Closure Library, but this version of Blockly still relies on them.

All usages of goog.is* in the affected Blockly core files have been updated to use Blockly.goog.is* instead.

Mostly this did via the gemini CLI: summary of the session:

Session summary:

Find all usages of goog.is(Def|Null|DefAndNotNull|String|Boolean|Number) (regex)

Found 10 matches in 7 files under static/third_party/lib/blockly/core/.

Those functions were deleted by the library. Create a new file with those functions in that directory, using google/closure-library@9325ce1 as a reference, and then replace all usages in those files with the new definition.

Created a new file static/third_party/lib/blockly/core/goog-polyfill.js with the specified functions and updated 7 files to use the new polyfills.

That's generally good, but rename the file to goog-polyfill.js

Renamed the file as requested.

Also make sure the functions are defined in the Blockly namespace

Moved the functions into the Blockly.goog namespace and updated the calls in the 7 files.

Also define isFunction

Added Blockly.goog.isFunction to the polyfill file and updated its usage in an additional file, field_dropdown.js.

Re-adds the goog.isDef, goog.isNull, goog.isDefAndNotNull,
goog.isString, goog.isBoolean, goog.isNumber, and goog.isFunction
functions as polyfills under the Blockly.goog namespace.

This change is necessary because these functions were removed from the
Closure Library, but Blockly still relies on them.

All usages of goog.is* in the affected Blockly core files have been updated
to use Blockly.goog.is* instead.

Session summary:
> Find all usages of goog.is(Def|Null|DefAndNotNull|String|Boolean|Number) (regex)
Found 10 matches in 7 files under static/third_party/lib/blockly/core/.

> Those functions were deleted by the library. Create a new file with those functions in that directory, using google/closure-library@9325ce1 as a reference, and then replace all usages in those files with the new definition.
Created a new file static/third_party/lib/blockly/core/goog-polyfill.js with the specified functions and updated 7 files to use the new polyfills.

> That's generally good, but rename the file to goog-polyfill.js
Renamed the file as requested.

> Also make sure the functions are defined in the Blockly namespace
Moved the functions into the `Blockly.goog` namespace and updated the calls in the 7 files.

> Also define isFunction
Added `Blockly.goog.isFunction` to the polyfill file and updated its usage in an additional file, `field_dropdown.js`.
@Jezzamonn Jezzamonn merged commit 36b61c8 into google:main Dec 24, 2025
2 checks passed
@Jezzamonn
Copy link
Collaborator Author

Fixes #240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant