✨ validate user-defined command name against built-in commands
This commit is contained in:
parent
b6f1f1b97f
commit
4a6a97aec5
@ -125,9 +125,18 @@ class Juicescript_parser {
|
|||||||
|
|
||||||
|
|
||||||
// COMMAND NAME MUST BE UNIQUE //
|
// COMMAND NAME MUST BE UNIQUE //
|
||||||
|
// check against built-in commands
|
||||||
|
if(Object.keys(Juicescript.command).includes(name)){
|
||||||
|
// ignore with error
|
||||||
|
this.error("connot redefine built-in command '" + name + "'");
|
||||||
|
name = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check against user-defined commands
|
||||||
if(Object.keys(this.tree.scope).includes(name)){
|
if(Object.keys(this.tree.scope).includes(name)){
|
||||||
// ignore with error
|
// ignore with error
|
||||||
this.error("connot redefine command '" + name + "'");
|
this.error("connot redefine user-defined command '" + name + "'");
|
||||||
|
name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user