Some code cleanup.

This commit is contained in:
Karishma Chadha 2017-11-13 16:55:57 -05:00
parent 3f444138db
commit 386045f033
3 changed files with 4 additions and 4 deletions

View file

@ -87,7 +87,7 @@ class Target extends EventEmitter {
const variable = this.lookupVariableById(id); const variable = this.lookupVariableById(id);
if (variable) return variable; if (variable) return variable;
// No variable with this name exists - create it locally. // No variable with this name exists - create it locally.
const newVariable = new Variable(id, name, '', false); const newVariable = new Variable(id, name, Variable.SCALAR_TYPE, false);
this.variables[id] = newVariable; this.variables[id] = newVariable;
return newVariable; return newVariable;
} }

View file

@ -9,7 +9,7 @@ class Variable {
/** /**
* @param {string} id Id of the variable. * @param {string} id Id of the variable.
* @param {string} name Name of the variable. * @param {string} name Name of the variable.
* @param {(string|number)} type Type of the variable, one of "" or "list" * @param {string} type Type of the variable, one of '' or 'list'
* @param {boolean} isCloud Whether the variable is stored in the cloud. * @param {boolean} isCloud Whether the variable is stored in the cloud.
* @constructor * @constructor
*/ */

View file

@ -234,7 +234,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel) {
const newVariable = new Variable( const newVariable = new Variable(
getVariableId(variable.name), getVariableId(variable.name),
variable.name, variable.name,
'', Variable.SCALAR_TYPE,
variable.isPersistent variable.isPersistent
); );
newVariable.value = variable.value; newVariable.value = variable.value;
@ -254,7 +254,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel) {
const newVariable = new Variable( const newVariable = new Variable(
getVariableId(list.listName), getVariableId(list.listName),
list.listName, list.listName,
'list', Variable.LIST_TYPE,
list.isPersistent list.isPersistent
); );
newVariable.value = list.contents; newVariable.value = list.contents;