From a01f59a545d3a8ce3b892fe86d54acc4e4d8625c Mon Sep 17 00:00:00 2001 From: DrMaxNix Date: Sat, 1 Oct 2022 21:13:45 +0200 Subject: [PATCH] :sparkles: make sure optional parameters are followed by optional ones --- src/parser.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/parser.js b/src/parser.js index 31202b9..b241663 100644 --- a/src/parser.js +++ b/src/parser.js @@ -339,6 +339,7 @@ class Juicescript_parser { let parameter_list = []; + let had_optional = false; while(!this.is_at_end()){ // IS NEXT TOKEN A DELIMITER? // if(this.match_type(Juicescript.token_type.DELIMITER)){ @@ -388,6 +389,13 @@ class Juicescript_parser { // remember 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:"); }