0
0

🚸 improve data type validation

This commit is contained in:
DrMaxNix 2022-10-02 17:11:03 +02:00
parent 860a58bbc2
commit a8022312dd
5 changed files with 12 additions and 4 deletions

View File

@ -33,7 +33,7 @@ Juicescript.command_define({
let data_type = runner.data_type(add);
if(data_type !== Juicescript.data_type.NUM && data_type !== Juicescript.data_type.STR){
// ignore with warning
runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(data_type));
runner.warning_argument(q, "expected data type NUM or STR, but got " + Juicescript.data_type.name(data_type));
continue;
}

View File

@ -33,7 +33,7 @@ Juicescript.command_define({
let data_type = runner.data_type(devide);
if(data_type !== Juicescript.data_type.NUM){
// ignore with warning
runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(data_type));
runner.warning_argument(q, "expected data type NUM, but got " + Juicescript.data_type.name(data_type));
continue;
}

View File

@ -16,6 +16,14 @@ Juicescript.command_define({
// flag name
let flag = runner.argument_value(1);
// validate data type
let data_type = runner.data_type(flag);
if(data_type !== Juicescript.data_type.STR){
// ignore with warning
runner.warning_argument(1, "expected data type STR, but got " + Juicescript.data_type.name(data_type));
return;
}
// load this scope's flag list
let flag_list = runner.scope_tree.flag;

View File

@ -35,7 +35,7 @@ Juicescript.command_define({
let factor_data_type = runner.data_type(factor);
if(factor_data_type !== Juicescript.data_type.NUM){
// ignore with warning
runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(factor_data_type));
runner.warning_argument(q, "expected data type NUM, but got " + Juicescript.data_type.name(factor_data_type));
continue;
}

View File

@ -33,7 +33,7 @@ Juicescript.command_define({
let data_type = runner.data_type(subtract);
if(data_type !== Juicescript.data_type.NUM){
// ignore with warning
runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(data_type));
runner.warning_argument(q, "expected data type NUM, but got " + Juicescript.data_type.name(data_type));
continue;
}