Skip to content

Commit ec3a08e

Browse files
committed
Reverted changes to upgrade_project.ts.
Removed parametersHaveComponentInformation and mrcParametersHaveComponentInformation from mrc_mechanism.ts. These were set, but never actually used. Removed upgrade_005_to_006 from mrc_mechanism.ts.
1 parent 83bcb1d commit ec3a08e

File tree

2 files changed

+1
-43
lines changed

2 files changed

+1
-43
lines changed

src/blocks/mrc_mechanism.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ type MechanismExtraState = {
5757
mechanismId?: string,
5858
importModule?: string,
5959
parameters?: Parameter[],
60-
parametersHaveComponentInformation?: boolean,
6160
}
6261

6362
const WARNING_ID_NOT_IN_HOLDER = 'not in holder';
@@ -69,7 +68,6 @@ interface MechanismMixin extends MechanismMixinType {
6968
mrcMechanismId: string,
7069
mrcImportModule: string,
7170
mrcParameters: Parameter[],
72-
mrcParametersHaveComponentInformation: boolean,
7371

7472
/**
7573
* mrcHasNotInHolderWarning is set to true if we set the NOT_IN_HOLDER warning text on the block.
@@ -87,7 +85,6 @@ const MECHANISM = {
8785
* Block initialization.
8886
*/
8987
init: function (this: MechanismBlock): void {
90-
this.mrcParametersHaveComponentInformation = false;
9188
this.mrcHasNotInHolderWarning = false;
9289
this.setStyle(MRC_STYLE_MECHANISMS);
9390
const nameField = new Blockly.FieldTextInput('')
@@ -107,7 +104,6 @@ const MECHANISM = {
107104
const extraState: MechanismExtraState = {
108105
mechanismModuleId: this.mrcMechanismModuleId,
109106
mechanismId: this.mrcMechanismId,
110-
parametersHaveComponentInformation: this.mrcParametersHaveComponentInformation,
111107
};
112108
extraState.parameters = [];
113109
this.mrcParameters.forEach((arg) => {
@@ -131,8 +127,6 @@ const MECHANISM = {
131127
this.mrcParameters.push({...arg});
132128
});
133129
}
134-
this.mrcParametersHaveComponentInformation = (extraState.parametersHaveComponentInformation == undefined)
135-
? false : extraState.parametersHaveComponentInformation;
136130
this.updateBlock_();
137131
},
138132
/**
@@ -302,7 +296,6 @@ const MECHANISM = {
302296
componentPortsIndex++;
303297
}
304298
});
305-
this.mrcParametersHaveComponentInformation = true;
306299
this.updateBlock_();
307300
} else {
308301
// Did not find the mechanism.
@@ -331,12 +324,6 @@ const MECHANISM = {
331324
this.mrcMechanismId = oldIdToNewId[this.mrcMechanismId];
332325
}
333326
},
334-
upgrade_005_to_006: function(this: MechanismBlock) {
335-
// At the time when this upgrade method is called, we can't look up the component information
336-
// for each parameter. Instead, we just mark this block as not having the information. Later,
337-
// in the checkMechanism method, we will retrieve the component information for each parameter.
338-
this.mrcParametersHaveComponentInformation = false;
339-
},
340327
};
341328

342329
export const setup = function () {
@@ -372,7 +359,6 @@ export function createMechanismBlock(
372359
mechanismModuleId: mechanism.moduleId,
373360
importModule: snakeCaseName,
374361
parameters: [],
375-
parametersHaveComponentInformation: true,
376362
};
377363
const inputs: {[key: string]: any} = {};
378364
let i = 0;
@@ -396,13 +382,3 @@ export function createMechanismBlock(
396382
fields[FIELD_TYPE] = mechanism.className;
397383
return new toolboxItems.Block(BLOCK_NAME, extraState, fields, inputs);
398384
}
399-
400-
/**
401-
* Upgrades the MechanismBlocks in the given workspace from version 005 to 006.
402-
* This function should only be called when upgrading old projects.
403-
*/
404-
export function upgrade_005_to_006(workspace: Blockly.Workspace): void {
405-
workspace.getBlocksByType(BLOCK_NAME).forEach(block => {
406-
(block as MechanismBlock).upgrade_005_to_006();
407-
});
408-
}

src/storage/upgrade_project.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ import * as storageNames from './names';
2929
import * as storageProject from './project';
3030
import { upgrade_001_to_002 } from '../blocks/mrc_mechanism_component_holder';
3131
import { upgrade_002_to_003, upgrade_004_to_005 } from '../blocks/mrc_class_method_def';
32-
import { upgrade_005_to_006 } from '../blocks/mrc_mechanism';
3332
import * as workspaces from '../blocks/utils/workspaces';
3433

3534
export const NO_VERSION = '0.0.0';
36-
export const CURRENT_VERSION = '0.0.6';
35+
export const CURRENT_VERSION = '0.0.5';
3736

3837
export async function upgradeProjectIfNecessary(
3938
storage: commonStorage.Storage, projectName: string): Promise<void> {
@@ -67,11 +66,6 @@ export async function upgradeProjectIfNecessary(
6766
// @ts-ignore
6867
case '0.0.4':
6968
upgradeFrom_004_to_005(storage, projectName, projectInfo);
70-
71-
// Intentional fallthrough after case '0.0.5'
72-
// @ts-ignore
73-
case '0.0.5':
74-
upgradeFrom_005_to_006(storage, projectName, projectInfo);
7569
}
7670
await storageProject.saveProjectInfo(storage, projectName);
7771
}
@@ -218,15 +212,3 @@ async function upgradeFrom_004_to_005(
218212
anyModuleType, upgrade_004_to_005);
219213
projectInfo.version = '0.0.5';
220214
}
221-
222-
async function upgradeFrom_005_to_006(
223-
storage: commonStorage.Storage,
224-
projectName: string,
225-
projectInfo: storageProject.ProjectInfo): Promise<void> {
226-
// mrc_mechanism blocks may have component information for each parameter.
227-
await upgradeBlocksFiles(
228-
storage, projectName,
229-
noModuleTypes, noPreupgrade,
230-
anyModuleType, upgrade_005_to_006);
231-
projectInfo.version = '0.0.6';
232-
}

0 commit comments

Comments
 (0)