|
@@ -3,7 +3,7 @@ import * as Models from './ivprog_elements';
|
|
|
import { LocalizedStrings } from './../services/localizedStringsService';
|
|
|
import * as Utils from './utils';
|
|
|
import { registerUserEvent, registerSystemEvent, ActionTypes } from "./../services/userLog";
|
|
|
-
|
|
|
+import { isValidIdentifier } from "./../util/utils";
|
|
|
var counter_new_globals = 0;
|
|
|
|
|
|
export function addGlobal (program, is_from_click = false) {
|
|
@@ -62,7 +62,7 @@ function updateName (global_var, new_name, global_obj_dom) {
|
|
|
global_var.name = new_name;
|
|
|
}
|
|
|
} else {
|
|
|
- Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), LocalizedStrings.getUI('inform_valid_name'));
|
|
|
+ Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), LocalizedStrings.getError('inform_valid_identifier'));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -75,10 +75,6 @@ function globalNameAlreadyExists (global_name) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-function isValidIdentifier (identifier_str) {
|
|
|
- return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
|
|
|
-}
|
|
|
-
|
|
|
function updateType (global_var, new_type, new_dimensions = 0) {
|
|
|
global_var.type = new_type;
|
|
|
global_var.dimensions = new_dimensions;
|