Update to use explicit procedure names and ids

This commit is contained in:
Paul Kaplan 2017-11-29 12:00:00 -05:00
parent 80b4dab104
commit 5a53323715
4 changed files with 12 additions and 11 deletions

View file

@ -206,7 +206,7 @@ class Blocks {
* @param {?string} name Name of procedure to query.
* @return {?Array.<string>} List of param names for a procedure.
*/
getProcedureParamNames (name) {
getProcedureParamNamesAndIds (name) {
const cachedNames = this._cache.procedureParamNames[name];
if (typeof cachedNames !== 'undefined') {
return cachedNames;
@ -217,9 +217,10 @@ class Blocks {
const block = this._blocks[id];
if (block.opcode === 'procedures_prototype' &&
block.mutation.proccode === name) {
const paramNames = JSON.parse(block.mutation.argumentnames);
this._cache.procedureParamNames[name] = paramNames;
return paramNames;
const names = JSON.parse(block.mutation.argumentnames);
const ids = JSON.parse(block.mutation.argumentids);
this._cache.procedureParamNames[name] = [names, ids];
return this._cache.procedureParamNames[name];
}
}