✨ make sure optional parameters are followed by optional ones
This commit is contained in:
parent
927beb3f1d
commit
a01f59a545
@ -339,6 +339,7 @@ class Juicescript_parser {
|
|||||||
|
|
||||||
|
|
||||||
let parameter_list = [];
|
let parameter_list = [];
|
||||||
|
let had_optional = false;
|
||||||
while(!this.is_at_end()){
|
while(!this.is_at_end()){
|
||||||
// IS NEXT TOKEN A DELIMITER? //
|
// IS NEXT TOKEN A DELIMITER? //
|
||||||
if(this.match_type(Juicescript.token_type.DELIMITER)){
|
if(this.match_type(Juicescript.token_type.DELIMITER)){
|
||||||
@ -388,6 +389,13 @@ class Juicescript_parser {
|
|||||||
|
|
||||||
// remember
|
// remember
|
||||||
optional = true;
|
optional = true;
|
||||||
|
had_optional = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure optional parameters are followed by optional ones
|
||||||
|
if(had_optional && !optional){
|
||||||
|
// ignore with error
|
||||||
|
this.error_token("parameter must be optional:");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user