File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,15 @@ const milestoneVersions = [
4343 '0.8.22' ,
4444 '0.8.27' ,
4545 '0.8.29'
46- ] . map ( ( milestone ) => maxSatisfying ( supportedVersions , `<${ milestone } ` ) ! ) ;
46+ ] . map (
47+ // Since we are aiming to find the highest compatible Language version, we
48+ // define a milestone as the highest possible supported version that is
49+ // smaller than the original milestone taken from the documentation.
50+ // This has an extra cost in execution time and the actual list could be
51+ // hardcoded, but the calculation is done only once and it's easier to
52+ // maintain.
53+ ( milestone ) => maxSatisfying ( supportedVersions , `<${ milestone } ` ) !
54+ ) ;
4755
4856export function createParser (
4957 text : string ,
@@ -71,7 +79,7 @@ export function createParser(
7179 inferredRanges . includes ( milestone )
7280 ) ;
7381
74- for ( let i = inferredMilestones . length - 1 ; i > 0 ; i -= 1 ) {
82+ for ( let i = inferredMilestones . length - 1 ; i >= 0 ; i -= 1 ) {
7583 const version = inferredMilestones [ i ] ;
7684 result . parser = Parser . create ( version ) ;
7785 result . parseOutput = result . parser . parseNonterminal (
You can’t perform that action at this time.
0 commit comments