1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 09:12:28 +01:00

Normalise command/option/mapping config object param name.

s/extraInfo/extra/
This commit is contained in:
Doug Kearns
2015-07-23 01:19:57 +10:00
parent 779752d776
commit c035aa936b
4 changed files with 26 additions and 26 deletions

View File

@@ -833,7 +833,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
// add mappings for commands like h,j,k,l,etc. in CARET, VISUAL and TEXT_EDIT mode
function addMovementMap(keys, description, hasCount, caretModeMethod, caretModeArg, textEditCommand, visualTextEditCommand) {
let extraInfo = {
let extra = {
count: !!hasCount,
type: "operator"
};
@@ -872,7 +872,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
}
}
},
extraInfo);
extra);
mappings.add([modes.CARET, modes.TEXT_EDIT, modes.OPERATOR], keys, description,
function ({ count }) {
@@ -885,7 +885,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
caretExecute(false);
}
},
extraInfo);
extra);
}
// add mappings for commands like i,a,s,c,etc. in TEXT_EDIT mode

View File

@@ -439,7 +439,7 @@ var Mappings = Module("mappings", {
* @param {string} description A description of the key mapping.
* @param {function} action The action invoked by each key sequence.
* @param {Object} extra An optional extra configuration hash (see
* {@link Map#extraInfo}).
* {@link Map#extra}).
* @optional
*/
addUserMap: deprecated("group.mappings.add", function addUserMap() {

View File

@@ -113,8 +113,8 @@ update(CommandOption, {
* command name prefix.
* @param {string} description A short one line description of the command.
* @param {function} action The action invoked by this command when executed.
* @param {Object} extraInfo An optional extra configuration hash. The
* following properties are supported.
* @param {Object} extra An optional extra configuration hash. The following
* properties are supported.
* always - see {@link Command#always}
* argCount - see {@link Command#argCount}
* bang - see {@link Command#bang}
@@ -131,19 +131,19 @@ update(CommandOption, {
* @private
*/
var Command = Class("Command", {
init: function init(specs, description, action, extraInfo) {
init: function init(specs, description, action, extra) {
specs = Array.concat(specs); // XXX
this.specs = specs;
this.description = description;
this.action = action;
if (extraInfo.options)
this._options = extraInfo.options;
delete extraInfo.options;
if (extra.options)
this._options = extra.options;
delete extra.options;
if (extraInfo)
this.update(extraInfo);
if (extra)
this.update(extra);
},
get toStringParams() { return [this.name, this.hive.name]; },

View File

@@ -35,8 +35,8 @@ let ValueError = Class("ValueError", ErrorBase);
* @param {string} description A short one line description of the option.
* @param {string} type The option's value data type (see {@link Option#type}).
* @param {string} defaultValue The default value for this option.
* @param {Object} extraInfo An optional extra configuration hash. The
* following properties are supported.
* @param {Object} extra An optional extra configuration hash. The following
* properties are supported.
* completer - see {@link Option#completer}
* domains - see {@link Option#domains}
* getter - see {@link Option#getter}
@@ -50,14 +50,14 @@ let ValueError = Class("ValueError", ErrorBase);
* @private
*/
var Option = Class("Option", {
init: function init(modules, names, description, defaultValue, extraInfo) {
init: function init(modules, names, description, defaultValue, extra) {
this.modules = modules;
this.name = names[0];
this.realNames = names;
this.description = description;
if (extraInfo)
this.update(extraInfo);
if (extra)
this.update(extra);
this._defaultValue = defaultValue;
@@ -836,8 +836,8 @@ var OptionHive = Class("OptionHive", Contexts.Hive, {
this.has = v => hasOwnProperty(this.values, v);
},
add: function add(names, description, type, defaultValue, extraInfo) {
return this.modules.options.add(names, description, type, defaultValue, extraInfo);
add: function add(names, description, type, defaultValue, extra) {
return this.modules.options.add(names, description, type, defaultValue, extra);
}
});
@@ -952,20 +952,20 @@ var Options = Module("options", {
* @param {string} type The option type (see {@link Option#type}).
* @param {value} defaultValue The option's default value.
* @param {Object} extra An optional extra configuration hash (see
* {@link Map#extraInfo}).
* {@link Map#extra}).
* @optional
*/
add: function add(names, description, type, defaultValue, extraInfo) {
add: function add(names, description, type, defaultValue, extra) {
if (!util.isDactyl(Components.stack.caller))
deprecated.warn(add, "options.add", "group.options.add");
util.assert(type in Option.types, _("option.noSuchType", type),
false);
if (!extraInfo)
extraInfo = {};
if (!extra)
extra = {};
extraInfo.definedAt = contexts.getCaller(Components.stack.caller);
extra.definedAt = contexts.getCaller(Components.stack.caller);
let name = names[0];
if (name in this._optionMap) {
@@ -976,12 +976,12 @@ var Options = Module("options", {
let closure = () => this._optionMap[name];
memoize(this._optionMap, name,
() => Option.types[type](modules, names, description, defaultValue, extraInfo));
() => Option.types[type](modules, names, description, defaultValue, extra));
for (let alias of names.slice(1))
memoize(this._optionMap, alias, closure);
if (extraInfo.setter && (!extraInfo.scope || extraInfo.scope & Option.SCOPE_GLOBAL))
if (extra.setter && (!extra.scope || extra.scope & Option.SCOPE_GLOBAL))
if (this.dactyl.initialized)
closure().initValue();
else