Skip to content

Commit 5a2048d

Browse files
authored
Merge pull request #146 from smalruby/issues/134_variables3
リストを変換できない不具合を修正 refs #134
2 parents 9e0ed55 + 92631b5 commit 5a2048d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/lib/ruby-to-blocks-converter/index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ class RubyToBlocksConverter {
317317
if (block.fields[before]) {
318318
block.fields[after] = block.fields[before];
319319
block.fields[after].name = after;
320+
block.fields[after].variableType = varType;
320321
delete block.fields[before];
321322

322323
const varName = block.fields[after].value;
@@ -668,7 +669,8 @@ class RubyToBlocksConverter {
668669
VARIABLE: {
669670
name: 'VARIABLE',
670671
id: variable.id,
671-
value: variable.name
672+
value: variable.name,
673+
variableType: Variable.SCALAR_TYPE
672674
}
673675
}
674676
});
@@ -694,7 +696,8 @@ class RubyToBlocksConverter {
694696
LIST: {
695697
name: 'LIST',
696698
id: variable.id,
697-
value: variable.name
699+
value: variable.name,
700+
variableType: Variable.LIST_TYPE
698701
}
699702
}
700703
});
@@ -1156,7 +1159,8 @@ class RubyToBlocksConverter {
11561159
VARIABLE: {
11571160
name: 'VARIABLE',
11581161
id: variable.id,
1159-
value: variable.name
1162+
value: variable.name,
1163+
variableType: Variable.SCALAR_TYPE
11601164
}
11611165
}
11621166
});
@@ -1262,7 +1266,8 @@ class RubyToBlocksConverter {
12621266
[name]: {
12631267
name: name,
12641268
id: variable.id,
1265-
value: variable.name
1269+
value: variable.name,
1270+
variableType: variable.type
12661271
}
12671272
}
12681273
});
@@ -1294,7 +1299,8 @@ class RubyToBlocksConverter {
12941299
VARIABLE: {
12951300
name: 'VARIABLE',
12961301
id: variable.id,
1297-
value: variable.name
1302+
value: variable.name,
1303+
variableType: Variable.SCALAR_TYPE
12981304
}
12991305
}
13001306
});

test/helpers/expect-to-equal-blocks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const expectToEqualFields = function (context, actualFields, expectedFieldsInfo)
3535
expectedType = Variable.LIST_TYPE;
3636
}
3737
expect(variable.type).toEqual(expectedType);
38+
expect(field).toHaveProperty('variableType', expectedType);
3839
} else {
3940
expect(field.id).toEqual(void 0);
4041
expect(field.value).toEqual(expectedField.value);

0 commit comments

Comments
 (0)