File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1462,6 +1462,23 @@ export class SchemeParser implements Parser {
14621462 const sexprElements = this . parse ( true ) ;
14631463 // then take the rest of the top level elements (total - n) from the restElements.
14641464 const restElements = sexprElements . slice ( numImports ) ;
1465+
1466+ // It would be convenient to map the entire restElements to a single sequence, using begin.
1467+ // We should accomodate for an empty restElements array (leave as is),
1468+ // a single element (leave as is),
1469+ // and multiple elements (wrap in begin, represented as a list).
1470+ const finalRestElements =
1471+ restElements . length === 0
1472+ ? restElements
1473+ : restElements . length === 1
1474+ ? restElements
1475+ : [
1476+ new Extended . List ( restElements [ 0 ] . location , [
1477+ new Atomic . Symbol ( restElements [ 0 ] . location , "begin" ) ,
1478+ ...restElements ,
1479+ ] ) ,
1480+ ] ;
1481+
14651482 // add the imports to the restElements
14661483 const finalElements = importElements . concat ( restElements ) ;
14671484
You can’t perform that action at this time.
0 commit comments