@@ -112,7 +112,8 @@ Blockly.Blocks.variables_set = {
112
112
113
113
Blockly . propc . variables_get = function ( ) {
114
114
// Variable getter.
115
- var code = Blockly . propc . variableDB_ . getName ( this . getFieldValue ( 'VAR' ) . replace ( / ^ [ ^ a - z A - Z _ ] + | [ ^ a - z A - Z _ 0 - 9 ] + / g, '_' ) ,
115
+ var code = Blockly . propc . variableDB_ . getName (
116
+ this . getFieldValue ( 'VAR' ) ,
116
117
Blockly . Variables . NAME_TYPE ) ;
117
118
return [ code , Blockly . propc . ORDER_ATOMIC ] ;
118
119
} ;
@@ -123,7 +124,8 @@ Blockly.propc.variables_declare = function () {
123
124
//TODO: settype to variable
124
125
var argument0 = Blockly . propc . valueToCode ( this , 'VALUE' ,
125
126
Blockly . propc . ORDER_ASSIGNMENT ) || '0' ;
126
- var varName = Blockly . propc . variableDB_ . getName ( this . getFieldValue ( 'VAR' ) . replace ( / ^ [ ^ a - z A - Z _ ] + | [ ^ a - z A - Z _ 0 - 9 ] + / g, '_' ) ,
127
+ var varName = Blockly . propc . variableDB_ . getName (
128
+ this . getFieldValue ( 'VAR' ) ,
127
129
Blockly . Variables . NAME_TYPE ) ;
128
130
Blockly . propc . setups_ [ 'setup_var' + varName ] = varName + ' = ' + argument0 + ';\n' ;
129
131
Blockly . propc . vartype_ [ varName ] = dropdown_type ;
@@ -134,7 +136,8 @@ Blockly.propc.variables_set = function () {
134
136
// Variable setter.
135
137
var argument0 = Blockly . propc . valueToCode ( this , 'VALUE' ,
136
138
Blockly . propc . ORDER_ASSIGNMENT ) || '0' ;
137
- var varName = Blockly . propc . variableDB_ . getName ( this . getFieldValue ( 'VAR' ) . replace ( / ^ [ ^ a - z A - Z _ ] + | [ ^ a - z A - Z _ 0 - 9 ] + / g, '_' ) ,
139
+ var varName = Blockly . propc . variableDB_ . getName (
140
+ this . getFieldValue ( 'VAR' ) ,
138
141
Blockly . Variables . NAME_TYPE ) ;
139
142
if ( Blockly . propc . vartype_ [ varName ] === undefined ) {
140
143
if ( argument0 . indexOf ( "int" ) > - 1 ) {
@@ -370,4 +373,4 @@ Blockly.propc.array_clear = function () {
370
373
} else {
371
374
return 'memset(' + varName + ', 0, sizeof ' + varName + ');\n' ;
372
375
}
373
- } ;
376
+ } ;
0 commit comments