@@ -21,7 +21,7 @@ const MicroBitConverter = {
21
21
this . _addFieldInput (
22
22
block , 'BTN' , 'microbit_menu_buttons' , 'buttons' ,
23
23
args [ 1 ] , 'A'
24
- )
24
+ ) ;
25
25
this . _setParent ( rubyBlock , block ) ;
26
26
}
27
27
break ;
@@ -41,7 +41,7 @@ const MicroBitConverter = {
41
41
this . _addFieldInput (
42
42
block , 'DIRECTION' , 'microbit_menu_tiltDirectionAny' , 'tiltDirectionAny' ,
43
43
args [ 1 ] , 'any'
44
- )
44
+ ) ;
45
45
this . _setParent ( rubyBlock , block ) ;
46
46
}
47
47
break ;
@@ -51,7 +51,7 @@ const MicroBitConverter = {
51
51
this . _addFieldInput (
52
52
block , 'PIN' , 'microbit_menu_touchPins' , 'touchPins' ,
53
53
args [ 1 ] , '0'
54
- )
54
+ ) ;
55
55
this . _setParent ( rubyBlock , block ) ;
56
56
}
57
57
break ;
@@ -79,14 +79,7 @@ const MicroBitConverter = {
79
79
}
80
80
break ;
81
81
case 'display' :
82
- make_display_block:
83
- if ( args . length === 5 ) {
84
- for ( const arg of args ) {
85
- if ( ! this . _isString ( arg ) ) {
86
- break make_display_block;
87
- }
88
- }
89
-
82
+ if ( args . length === 5 && args . every ( ( i ) => { return this . _isString ( i ) ; } ) ) {
90
83
block = this . _changeBlock ( receiver , 'microbit_displaySymbol' , 'statement' ) ;
91
84
delete this . _context . blocks [ receiver . inputs . EXPRESSION . block ] ;
92
85
delete receiver . inputs . EXPRESSION ;
@@ -95,7 +88,7 @@ const MicroBitConverter = {
95
88
for ( const arg of args ) {
96
89
matrix += arg ;
97
90
}
98
- matrix = matrix . replace ( / \. / g, '0' ) ;
91
+ matrix = matrix . replace ( / [ 1 - 9 ] / g , '1' ) . replace ( / [ ^ 1 - 9 ] / g, '0' ) ;
99
92
this . _addFieldInput (
100
93
block , 'MATRIX' , 'matrix' , 'MATRIX' ,
101
94
matrix , null
@@ -127,7 +120,7 @@ const MicroBitConverter = {
127
120
this . _addFieldInput (
128
121
block , 'DIRECTION' , 'microbit_menu_tiltDirectionAny' , 'tiltDirectionAny' ,
129
122
args [ 0 ] , 'any'
130
- )
123
+ ) ;
131
124
}
132
125
break ;
133
126
case 'tilt_angle' :
@@ -139,7 +132,7 @@ const MicroBitConverter = {
139
132
this . _addFieldInput (
140
133
block , 'DIRECTION' , 'microbit_menu_tiltDirection' , 'tiltDirection' ,
141
134
args [ 0 ] , 'front'
142
- )
135
+ ) ;
143
136
}
144
137
break ;
145
138
}
0 commit comments