diff --git a/core/field.js b/core/field.js index 17c1d2c88..c343359da 100644 --- a/core/field.js +++ b/core/field.js @@ -55,6 +55,7 @@ goog.requireType('Blockly.WorkspaceSvg'); * the individual field's documentation for a list of properties this * parameter supports. * @constructor + * @abstract * @implements {Blockly.IASTNodeLocationSvg} * @implements {Blockly.IASTNodeLocationWithBlock} * @implements {Blockly.IKeyboardAccessible} @@ -154,14 +155,6 @@ Blockly.Field = function(value, opt_validator, opt_config) { opt_validator && this.setValidator(opt_validator); }; -/** - * Construct a Field from a JSON arg object. - * @param {!Object} _options A JSON object with options. - */ -Blockly.Field.fromJson = function(_options) { - throw Error("Field subclass doesn't define fromJson"); -}; - /** * The default value for this field. * @type {*} diff --git a/core/field_dropdown.js b/core/field_dropdown.js index 7b9ff6356..5dad752d8 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -151,7 +151,7 @@ Blockly.FieldDropdown.ImageProperties; Blockly.FieldDropdown.fromJson = function(options) { // `this` might be a subclass of FieldDropdown if that class doesn't override // the static fromJson method. - return new Blockly.FieldDropdown(options['options'], undefined, options); + return new this(options['options'], undefined, options); }; /** diff --git a/core/field_multilineinput.js b/core/field_multilineinput.js index 7df835ebe..887d4007f 100644 --- a/core/field_multilineinput.js +++ b/core/field_multilineinput.js @@ -89,8 +89,8 @@ Blockly.FieldMultilineInput.prototype.configure_ = function(config) { */ Blockly.FieldMultilineInput.fromJson = function(options) { var text = Blockly.utils.replaceMessageReferences(options['text']); - // `this` might be a subclass of FieldLabel if that class doesn't override - // the static fromJson method. + // `this` might be a subclass of FieldMultilineInput if that class doesn't + // override the static fromJson method. return new this(text, undefined, options); };