-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JS Parser: Support top-level await for modules
Closes: #7408
- Loading branch information
1 parent
136e384
commit 2163885
Showing
10 changed files
with
148 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
webcommon/javascript2.editor/test/unit/data/testfiles/parser/topLevelAwait.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import dummy from './dummy.mjs'; | ||
|
||
const demo = await dummy(); |
64 changes: 64 additions & 0 deletions
64
webcommon/javascript2.editor/test/unit/data/testfiles/parser/topLevelAwait.js.ast.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
<FunctionNode name='topLevelAwait.js' kind='MODULE' start='0' end='888'> | ||
<isProgram/> | ||
<ImportNode start='826' end='856'> | ||
<ImportClauseNode start='833' end='838'> | ||
<IdentNode start='833' end='838'> | ||
<name>dummy</name> | ||
</IdentNode> | ||
</ImportClauseNode> | ||
<FromNode start='839' end='856'> | ||
<StringLiteralNode value='./dummy.mjs' start='845' end='843'/> | ||
</FromNode> | ||
</ImportNode> | ||
<!-- FunctionNode Parameters --> | ||
<!-- FunctionNode Body --> | ||
<Block start='0' end='887'> | ||
<isFunctionBody/> | ||
<isSynthetic/> | ||
<!-- Block Statements --> | ||
<VarNode name='demo' start='866' end='886'> | ||
<hasInit/> | ||
<isAssignment/> | ||
<isBlockScoped/> | ||
<isConst/> | ||
<!-- VarNode Assignment Dest --> | ||
<IdentNode start='866' end='870'> | ||
<name>demo</name> | ||
<isDeclaredHere/> | ||
<isInitializedHere/> | ||
</IdentNode> | ||
<!-- VarNode Init --> | ||
<UnaryNode type='AWAIT' start='873' end='886'> | ||
<!-- UnaryNode Expression --> | ||
<CallNode start='879' end='886'> | ||
<!-- CallNode Arguments --> | ||
<!-- CallNode Function --> | ||
<IdentNode start='879' end='884'> | ||
<name>dummy</name> | ||
</IdentNode> | ||
</CallNode> | ||
</UnaryNode> | ||
</VarNode> | ||
</Block> | ||
</FunctionNode> |
22 changes: 22 additions & 0 deletions
22
webcommon/javascript2.editor/test/unit/data/testfiles/parser/topLevelAwait.js.semantic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import |>GLOBAL:dummy<| |>CUSTOM2:from<| './dummy.mjs'; | ||
|
||
const demo = |>CUSTOM2:await<| |>GLOBAL:dummy<|(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters