Use prototypes for primitive properties.

This commit is contained in:
Neil Fraser 2015-09-12 19:31:22 -07:00
parent 1b43699ae3
commit 3f8e586fe8
9 changed files with 65 additions and 31 deletions

View file

@ -38,7 +38,6 @@ goog.require('goog.asserts');
*/
Blockly.Generator = function(name) {
this.name_ = name;
this.RESERVED_WORDS_ = '';
this.FUNCTION_NAME_PLACEHOLDER_REGEXP_ =
new RegExp(this.FUNCTION_NAME_PLACEHOLDER_, 'g');
};
@ -270,9 +269,17 @@ Blockly.Generator.prototype.addLoopTrap = function(branch, id) {
/**
* The method of indenting. Defaults to two spaces, but language generators
* may override this to increase indent or change to tabs.
* @type {string}
*/
Blockly.Generator.prototype.INDENT = ' ';
/**
* Comma-separated list of reserved words.
* @type {string}
* @private
*/
Blockly.Generator.prototype.RESERVED_WORDS_ = '';
/**
* Add one or more words to the list of reserved words for this language.
* @param {string} words Comma-separated list of words to add to the list.
@ -287,6 +294,7 @@ Blockly.Generator.prototype.addReservedWords = function(words) {
* Blockly.Generator.provideFunction_. It must not be legal code that could
* legitimately appear in a function definition (or comment), and it must
* not confuse the regular expression parser.
* @type {string}
* @private
*/
Blockly.Generator.prototype.FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}';