prettier-plugin-solidity 2.0.0-beta.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +61 -57
  2. package/dist/591f276013d241f7a687.wasm +0 -0
  3. package/dist/comments/handlers/handleContractDefinitionComments.js +7 -2
  4. package/dist/comments/handlers/handleContractDefinitionComments.js.map +1 -1
  5. package/dist/e5a84a17f0f9e01763d3.wasm +0 -0
  6. package/dist/ea6945b7193921081ced.wasm +0 -0
  7. package/dist/index.js +5 -5
  8. package/dist/index.js.map +1 -1
  9. package/dist/nodes/ContractDefinition.js +30 -10
  10. package/dist/nodes/ContractDefinition.js.map +1 -1
  11. package/dist/printer.js +1 -1
  12. package/dist/printer.js.map +1 -1
  13. package/dist/slang-comments/handlers/handle-contract-definition-comments.js +18 -8
  14. package/dist/slang-comments/handlers/handle-contract-definition-comments.js.map +1 -1
  15. package/dist/slang-comments/handlers/handle-contract-specifiers-comments.js +22 -0
  16. package/dist/slang-comments/handlers/handle-contract-specifiers-comments.js.map +1 -0
  17. package/dist/slang-comments/handlers/handle-storage-layout-specifier-comments.js +14 -0
  18. package/dist/slang-comments/handlers/handle-storage-layout-specifier-comments.js.map +1 -0
  19. package/dist/slang-comments/handlers/index.js +4 -0
  20. package/dist/slang-comments/handlers/index.js.map +1 -1
  21. package/dist/slang-nodes/ConditionalExpression.js +6 -12
  22. package/dist/slang-nodes/ConditionalExpression.js.map +1 -1
  23. package/dist/slang-nodes/ContractDefinition.js +5 -6
  24. package/dist/slang-nodes/ContractDefinition.js.map +1 -1
  25. package/dist/slang-nodes/ContractSpecifier.js +27 -0
  26. package/dist/slang-nodes/ContractSpecifier.js.map +1 -0
  27. package/dist/slang-nodes/ContractSpecifiers.js +31 -0
  28. package/dist/slang-nodes/ContractSpecifiers.js.map +1 -0
  29. package/dist/slang-nodes/Expression.js +3 -3
  30. package/dist/slang-nodes/FunctionCallExpression.js +3 -4
  31. package/dist/slang-nodes/FunctionCallExpression.js.map +1 -1
  32. package/dist/slang-nodes/IndexAccessExpression.js +3 -4
  33. package/dist/slang-nodes/IndexAccessExpression.js.map +1 -1
  34. package/dist/slang-nodes/{ComparisonExpression.js → InequalityExpression.js} +3 -3
  35. package/dist/slang-nodes/{ComparisonExpression.js.map → InequalityExpression.js.map} +1 -1
  36. package/dist/slang-nodes/ReturnStatement.js +3 -5
  37. package/dist/slang-nodes/ReturnStatement.js.map +1 -1
  38. package/dist/slang-nodes/StateVariableDefinition.js +3 -6
  39. package/dist/slang-nodes/StateVariableDefinition.js.map +1 -1
  40. package/dist/slang-nodes/StateVariableDefinitionValue.js +1 -2
  41. package/dist/slang-nodes/StateVariableDefinitionValue.js.map +1 -1
  42. package/dist/slang-nodes/StorageLayoutSpecifier.js +25 -0
  43. package/dist/slang-nodes/StorageLayoutSpecifier.js.map +1 -0
  44. package/dist/slang-nodes/TupleDeconstructionStatement.js +3 -4
  45. package/dist/slang-nodes/TupleDeconstructionStatement.js.map +1 -1
  46. package/dist/slang-nodes/VariableDeclarationStatement.js +3 -2
  47. package/dist/slang-nodes/VariableDeclarationStatement.js.map +1 -1
  48. package/dist/slang-nodes/YulExpression.js +0 -4
  49. package/dist/slang-nodes/YulExpression.js.map +1 -1
  50. package/dist/slang-utils/is-binary-operation.js +1 -1
  51. package/dist/slang-utils/is-binary-operation.js.map +1 -1
  52. package/dist/slang-utils/sort-contract-specifiers.js +14 -0
  53. package/dist/slang-utils/sort-contract-specifiers.js.map +1 -0
  54. package/dist/slangPrinter.js +2 -3
  55. package/dist/slangPrinter.js.map +1 -1
  56. package/dist/standalone.js +1 -1
  57. package/dist/standalone.js.map +1 -1
  58. package/package.json +18 -15
  59. package/src/comments/handlers/handleContractDefinitionComments.js +11 -2
  60. package/src/index.ts +5 -5
  61. package/src/nodes/ContractDefinition.js +31 -11
  62. package/src/printer.js +1 -1
  63. package/src/slang-comments/handlers/handle-contract-definition-comments.ts +21 -13
  64. package/src/slang-comments/handlers/handle-contract-specifiers-comments.ts +33 -0
  65. package/src/slang-comments/handlers/handle-storage-layout-specifier-comments.ts +23 -0
  66. package/src/slang-comments/handlers/index.ts +4 -0
  67. package/src/slang-nodes/ConditionalExpression.ts +4 -10
  68. package/src/slang-nodes/ContractDefinition.ts +6 -7
  69. package/src/slang-nodes/ContractSpecifier.ts +48 -0
  70. package/src/slang-nodes/ContractSpecifiers.ts +52 -0
  71. package/src/slang-nodes/Expression.ts +5 -5
  72. package/src/slang-nodes/FunctionCallExpression.ts +3 -4
  73. package/src/slang-nodes/IndexAccessExpression.ts +3 -4
  74. package/src/slang-nodes/{ComparisonExpression.ts → InequalityExpression.ts} +4 -4
  75. package/src/slang-nodes/ReturnStatement.ts +3 -5
  76. package/src/slang-nodes/StateVariableDefinition.ts +3 -6
  77. package/src/slang-nodes/StateVariableDefinitionValue.ts +1 -2
  78. package/src/slang-nodes/StorageLayoutSpecifier.ts +45 -0
  79. package/src/slang-nodes/TupleDeconstructionStatement.ts +3 -4
  80. package/src/slang-nodes/VariableDeclarationStatement.ts +3 -2
  81. package/src/slang-nodes/YulExpression.ts +1 -11
  82. package/src/slang-nodes/types.d.ts +8 -4
  83. package/src/slang-printers/print-binary-operation.ts +2 -2
  84. package/src/slang-utils/is-binary-operation.ts +1 -1
  85. package/src/slang-utils/sort-contract-specifiers.ts +25 -0
  86. package/src/slangPrinter.ts +2 -3
  87. package/src/types.d.ts +7 -220
  88. package/dist/28d7fb838862acf337c8.wasm +0 -0
  89. package/dist/80ab9aab2ee473939a05.wasm +0 -0
  90. package/dist/e0ce19302a589ebeaa6d.wasm +0 -0
  91. package/dist/slang-nodes/YulBuiltInFunction.js +0 -15
  92. package/dist/slang-nodes/YulBuiltInFunction.js.map +0 -1
  93. package/dist/slang-utils/prettier-version-satisfies.js +0 -6
  94. package/dist/slang-utils/prettier-version-satisfies.js.map +0 -1
  95. package/dist/slang-utils/print-warning.js +0 -12
  96. package/dist/slang-utils/print-warning.js.map +0 -1
  97. package/src/slang-nodes/YulBuiltInFunction.ts +0 -29
  98. package/src/slang-utils/prettier-version-satisfies.ts +0 -8
  99. package/src/slang-utils/print-warning.ts +0 -12
package/README.md CHANGED
@@ -8,13 +8,15 @@
8
8
  <img width="375" height="375" src="https://user-images.githubusercontent.com/1022054/59317198-f1149b80-8d15-11e9-9b0f-0c5e7d4b8b81.png">
9
9
  </p>
10
10
 
11
- A [Prettier plugin](https://prettier.io/docs/en/plugins.html) for automatically formatting your [Solidity](https://github.com/ethereum/solidity) code.
11
+ > ℹ️ This README is for the new major version of Prettier Plugin Solidity.
12
+ >
13
+ > The differences from v1 are minimal, but there are some breaking changes.
14
+ >
15
+ > To migrate from v1, follow the [migration guide](#migrating-from-v1).
16
+ >
17
+ > If you're looking for the previous version, check out the [v1 branch](https://github.com/prettier-solidity/prettier-plugin-solidity/tree/v1).
12
18
 
13
- ## Nomic Foundation's Slang
14
-
15
- Nomic Foundation has put a lot of effort in providing a set of compiler APIs that helped us rethink our approach to parsing and rely on their flexibility, detail oriented solution and continuos support of new and old Solidity syntaxes.
16
-
17
- Since v2.0.0 this package will ship with the Slang parser and this change must be implemented in existing configurations by replacing `parser: 'solidity-parse'` with `parser: 'slang-solidity'`.
19
+ A [Prettier](https://prettier.io/) plugin for automatically formatting your [Solidity](https://docs.soliditylang.org/en/latest/) code.
18
20
 
19
21
  ## Installation and usage
20
22
 
@@ -26,15 +28,13 @@ Install both `prettier` and `prettier-plugin-solidity`:
26
28
  npm install --save-dev prettier prettier-plugin-solidity
27
29
  ```
28
30
 
29
- > :package: ** Make sure `prettier`'s version is at least `3.0.0`**
30
-
31
- Run prettier in your contracts:
31
+ Run prettier on your contracts:
32
32
 
33
33
  ```Bash
34
34
  npx prettier --write --plugin=prettier-plugin-solidity 'contracts/**/*.sol'
35
35
  ```
36
36
 
37
- You can add a script for running prettier on all your contracts:
37
+ You can add an npm script to run prettier on all your contracts:
38
38
 
39
39
  ```
40
40
  "prettier": "prettier --write --plugin=prettier-plugin-solidity 'contracts/**/*.sol'"
@@ -50,13 +50,11 @@ Or you can use it as part of your linting to check that all your code is prettif
50
50
 
51
51
  ### Using in the Browser
52
52
 
53
- _Added in v1.1.0_
54
-
55
53
  To use this package in the browser, you need to load Prettier's standalone bundle before loading the build provided in this package.
56
54
 
57
55
  Prettier's unpkg field points to `https://unpkg.com/prettier/standalone.js`, in a similar way this plugin points to `https://unpkg.com/prettier-plugin-solidity/dist/standalone.js`.
58
56
 
59
- Once the scripts are loaded you will have access the globals `prettier` and `prettierPlugins`.
57
+ Once the scripts are loaded you will have access to the globals `prettier` and `prettierPlugins`.
60
58
 
61
59
  We follow Prettier's strategy for populating their plugins in the object `prettierPlugins`, you can load other plugins like `https://unpkg.com/prettier@2.8.0/parser-markdown.js` and Prettier will have access to multiple parsers.
62
60
 
@@ -71,7 +69,7 @@ We follow Prettier's strategy for populating their plugins in the object `pretti
71
69
 
72
70
  async function format(code) {
73
71
  return await prettier.format(code, {
74
- parser: 'slang-solidity',
72
+ parser: 'slang',
75
73
  plugins: [solidityPlugin]
76
74
  });
77
75
  }
@@ -81,26 +79,24 @@ We follow Prettier's strategy for populating their plugins in the object `pretti
81
79
  </script>
82
80
  ```
83
81
 
84
- For more details and please have a look at [Prettier's documentation](https://prettier.io/docs/en/browser.html).
82
+ For more details, have a look at [Prettier's documentation](https://prettier.io/docs/en/browser.html).
85
83
 
86
84
  ### Creating a package for the Browser
87
85
 
88
- _Added in v1.2.0_
89
-
90
86
  If you are creating your own package to be run in a browser, you might want to import the standalone files directly.
91
87
 
92
88
  ```Javascript
93
- import prettier from 'prettier/standalone';
94
- import solidityPlugin from 'prettier-plugin-solidity/standalone';
89
+ import prettier from "prettier/standalone";
90
+ import solidityPlugin from "prettier-plugin-solidity/standalone";
95
91
 
96
92
  async function format(code) {
97
93
  return await prettier.format(code, {
98
- parser: "slang-solidity",
94
+ parser: "slang",
99
95
  plugins: [solidityPlugin],
100
96
  });
101
97
  }
102
98
 
103
- const originalCode = 'contract Foo {}';
99
+ const originalCode = "contract Foo {}";
104
100
  const formattedCode = format(originalCode);
105
101
  ```
106
102
 
@@ -116,7 +112,7 @@ The following is the default configuration internally used by this plugin.
116
112
  {
117
113
  "files": "*.sol",
118
114
  "options": {
119
- "parser": "slang-solidity",
115
+ "parser": "slang",
120
116
  "printWidth": 80,
121
117
  "tabWidth": 4,
122
118
  "useTabs": false,
@@ -136,7 +132,7 @@ Most options are described in Prettier's [documentation](https://prettier.io/doc
136
132
 
137
133
  ### Compiler
138
134
 
139
- Many versions of the Solidity compiler have changes that affect how the code should be formatted. This plugin, by default, tries to format the code in the most compatible way that it's possible, but you can use the `compiler` option to nudge it in the right direction.
135
+ Many versions of the Solidity compiler have changes that affect how the code should be formatted. This plugin, by default, tries to format the code in the most compatible way that is possible, but you can use the `compiler` option to nudge it in the right direction.
140
136
 
141
137
  One example of this is import directives. Before `0.7.4`, the compiler didn't accept multi-line import statements, so we always format them in a single line. But if you use the `compiler` option to indicate that you are using a version greater or equal than `0.7.4`, the plugin will use multi-line imports when it makes sense.
142
138
 
@@ -216,9 +212,18 @@ You might have a multi-version project, where different files are compiled with
216
212
  | ------- | --------------------- | ---------------------- |
217
213
  | None | `--compiler <string>` | `compiler: "<string>"` |
218
214
 
219
- ### Experimental Ternaries
215
+ ### Parser
216
+
217
+ You can configure the parser used by Prettier Solidity. Two Solidity parsers are supported:
218
+
219
+ - [Slang](https://nomicfoundation.github.io/slang) (the default), a more powerful and correct parser that results in better formatting for some edge cases, especially when comments are involved.
220
+ - [Solidity Parser for JavaScript](https://github.com/solidity-parser/parser/), an [ANTLR](https://www.antlr.org/)-based parser. This is the version that Prettier Solidity v1 used by default. This parser is still supported in v2, but it's deprecated and will be removed in the next major version. You can use this parser by setting `parser: "antlr"` in your Prettier configuration.
220
221
 
221
- _Added in v1.3.0_
222
+ | Default | CLI Override | API Override |
223
+ | ------- | ------------------- | -------------------- |
224
+ | `slang` | `--parser <string>` | `parser: "<string>"` |
225
+
226
+ ### Experimental Ternaries
222
227
 
223
228
  Mimicking prettier's [new ternary formatting](https://prettier.io/blog/2023/11/13/curious-ternaries) for the community to try.
224
229
 
@@ -260,8 +265,7 @@ Plug 'prettier/vim-prettier', {
260
265
  \ 'solidity'] }
261
266
  ```
262
267
 
263
- We modified the `do` instruction to also install this plugin. Then you'll have to configure the plugin to always use the
264
- version installed in the vim plugin's directory. The vim-plug directory depends on value you use in `call plug#begin('~/.vim/<dir>')`:
268
+ We modified the `do` instruction to also install this plugin. Then you'll have to configure the plugin to always use the version installed in the vim plugin's directory. The vim-plug directory depends on the value you use in `call plug#begin('~/.vim/<dir>')`:
265
269
 
266
270
  ```vim
267
271
  let g:prettier#exec_cmd_path = '~/.vim/plugged/vim-prettier/node_modules/.bin/prettier'
@@ -280,34 +284,29 @@ Now Prettier will be run every time the file is saved.
280
284
 
281
285
  ### VSCode
282
286
 
283
- VSCode is not familiar with the Solidity language.
284
- There are 2 extensions that you can install to provide support for Solidity:
287
+ VSCode is not familiar with the Solidity language. There are two extensions that you can install to provide support for Solidity:
285
288
 
286
- - [`solidity`](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity)
287
289
  - [`hardhat-solidity`](https://marketplace.visualstudio.com/items?itemName=NomicFoundation.hardhat-solidity)
290
+ - [`solidity`](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity)
291
+
292
+ We recommend using the `hardhat-solidity` extension:
288
293
 
289
294
  ```Bash
290
- code --install-extension JuanBlanco.solidity
291
- # or
292
295
  code --install-extension NomicFoundation.hardhat-solidity
293
296
  ```
294
297
 
295
- > :warning: **These 2 extensions offer similar functionality and will clash with each other**: Please choose which one matches your projects better.
296
-
297
298
  These extensions provide basic integration with Prettier; in most cases, no further action is needed.
298
299
 
299
- Make sure your editor has format on save set to true.
300
- When you save VSCode will ask you what formatter would you like to use for the Solidity language, you can choose `JuanBlanco.solidity` or `NomicFoundation.hardhat-solidity`.
300
+ Make sure your editor has format-on-save set to true. When you save, VSCode will ask you what formatter would you like to use for the Solidity language. We recommend choosing `NomicFoundation.hardhat-solidity`.
301
301
 
302
302
  At this point VSCode's `settings.json` should have a configuration similar to this:
303
303
 
304
- ```JSON
304
+ ```JSON5
305
305
  {
306
306
  "editor.formatOnSave": true,
307
307
  "solidity.formatter": "prettier", // This is the default so it might be missing.
308
308
  "[solidity]": {
309
- // "editor.defaultFormatter": "JuanBlanco.solidity"
310
- // "editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
309
+ "editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
311
310
  }
312
311
  }
313
312
  ```
@@ -318,7 +317,7 @@ If you want more control over other details, you should proceed to install [`pre
318
317
  code --install-extension esbenp.prettier-vscode
319
318
  ```
320
319
 
321
- To interact with 3rd party plugins, `prettier-vscode` will look in the project's npm modules, so you'll need to have `prettier` and `prettier-plugin-solidity` in your `package.json`
320
+ To interact with third-party plugins, `prettier-vscode` will look in the project's npm modules, so you'll need to have `prettier` and `prettier-plugin-solidity` in your `package.json`
322
321
 
323
322
  ```Bash
324
323
  npm install --save-dev prettier prettier-plugin-solidity
@@ -326,7 +325,7 @@ npm install --save-dev prettier prettier-plugin-solidity
326
325
 
327
326
  This will allow you to specify the version of the plugin in case you want to use the latest version of the plugin or need to freeze the formatting since new versions of this plugin will implement tweaks on the possible formats.
328
327
 
329
- You'll have to let VSCode what formatter you prefer.
328
+ You'll have to let VSCode know what formatter you prefer.
330
329
  This can be done by opening the command palette and executing:
331
330
 
332
331
  ```
@@ -349,7 +348,7 @@ Now VSCode's `settings.json` should have this:
349
348
 
350
349
  Note: By design, Prettier prioritizes a local over a global configuration. If you have a `.prettierrc` file in your project, your VSCode's default settings or rules in `settings.json` are ignored ([prettier/prettier-vscode#1079](https://github.com/prettier/prettier-vscode/issues/1079)).
351
350
 
352
- ### Pnpm
351
+ ### pnpm
353
352
 
354
353
  To make Prettier Solidity work in your project, you have to add a `.prettierrc` file as shown [here](#configuration-file).
355
354
 
@@ -389,6 +388,26 @@ contract Foo is Bar {
389
388
 
390
389
  Notice that the unnecessary parentheses in `modifier2` were removed in the function but not in the constructor.
391
390
 
391
+ ## Migrating from v1
392
+
393
+ In most cases, upgrading to v2 of Prettier Solidity should be as easy as installing the latest version:
394
+
395
+ ```bash
396
+ npm install prettier-plugin-solidity@latest
397
+ ```
398
+
399
+ If you had the parser explicitly set in your config, you'll get this error:
400
+
401
+ ```
402
+ [error] Couldn't resolve parser "solidity-parse".
403
+ ```
404
+
405
+ To fix it, simply update the `parser` option in your `.prettierrc`:
406
+
407
+ ```
408
+ "parser": "slang",
409
+ ```
410
+
392
411
  ## Contributing
393
412
 
394
413
  1. [Fork it](https://github.com/prettier-solidity/prettier-plugin-solidity/fork)
@@ -398,21 +417,6 @@ Notice that the unnecessary parentheses in `modifier2` were removed in the funct
398
417
  5. Push to the branch (`git push origin feature/fooBar`)
399
418
  6. Create a new Pull Request
400
419
 
401
- ## Who's using it?
402
-
403
- These are some of the projects using Prettier Solidity:
404
-
405
- - [Bancor](https://app.bancor.network)
406
- - [Gelato](https://gelato.network/)
407
- - [Gnosis Protocol](https://docs.gnosis.io/protocol/)
408
- - [PieDAO](https://www.piedao.org/)
409
- - [Sablier](https://sablier.finance/)
410
- - [Synthetix](https://www.synthetix.io)
411
- - [The Sandbox](https://www.sandbox.game/en/)
412
- - [UMA](https://umaproject.org/)
413
- - [Uniswap](https://uniswap.org)
414
- - [Zora](https://zora.co)
415
-
416
420
  ## License
417
421
 
418
422
  Distributed under the MIT license. See [LICENSE](LICENSE) for more information.
Binary file
@@ -12,10 +12,15 @@ function handleContractDefinitionComments({ text, precedingNode, enclosingNode,
12
12
  // it is a {}.
13
13
  const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd);
14
14
  // The comment is behind the start of the Block `{}` or behind a base contract
15
- if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === 'InheritanceSpecifier' || nextCharacter === '{') {
15
+ if ((followingNode &&
16
+ (followingNode.type === 'InheritanceSpecifier' ||
17
+ followingNode === enclosingNode.storageLayout)) ||
18
+ nextCharacter === '{') {
16
19
  // In this scenario the comment belongs to a base contract.
17
20
  // contract A is B, /* comment for B */ C /* comment for C */ {}
18
- if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === 'InheritanceSpecifier') {
21
+ if (precedingNode &&
22
+ (precedingNode.type === 'InheritanceSpecifier' ||
23
+ precedingNode === enclosingNode.storageLayout)) {
19
24
  addTrailingComment(precedingNode, comment);
20
25
  return true;
21
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"handleContractDefinitionComments.js","sourceRoot":"","sources":["../../../src/comments/handlers/handleContractDefinitionComments.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAE5F,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;AAE3E,SAAS,gCAAgC,CAAC,EACxC,IAAI,EACJ,aAAa,EACb,aAAa,EACb,aAAa,EACb,OAAO,EACP,OAAO,EACR;IACC,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0EAA0E;IAC1E,2DAA2D;IAC3D,uCAAuC;IACvC,yEAAyE;IACzE,cAAc;IACd,MAAM,aAAa,GAAG,kCAAkC,CACtD,IAAI,EACJ,OAAO,EACP,OAAO,CAAC,MAAM,CACf,CAAC;IAEF,8EAA8E;IAC9E,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,sBAAsB,IAAI,aAAa,KAAK,GAAG,EAAE,CAAC;QAC5E,2DAA2D;QAC3D,kEAAkE;QAClE,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,sBAAsB,EAAE,CAAC;YACnD,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,+DAA+D;QAC/D,8CAA8C;QAC9C,8EAA8E;QAC9E,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,uCAAuC;IACvC,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxC,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,eAAe,gCAAgC,CAAC"}
1
+ {"version":3,"file":"handleContractDefinitionComments.js","sourceRoot":"","sources":["../../../src/comments/handlers/handleContractDefinitionComments.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAE5F,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;AAE3E,SAAS,gCAAgC,CAAC,EACxC,IAAI,EACJ,aAAa,EACb,aAAa,EACb,aAAa,EACb,OAAO,EACP,OAAO,EACR;IACC,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0EAA0E;IAC1E,2DAA2D;IAC3D,uCAAuC;IACvC,yEAAyE;IACzE,cAAc;IACd,MAAM,aAAa,GAAG,kCAAkC,CACtD,IAAI,EACJ,OAAO,EACP,OAAO,CAAC,MAAM,CACf,CAAC;IAEF,8EAA8E;IAC9E,IACE,CAAC,aAAa;QACZ,CAAC,aAAa,CAAC,IAAI,KAAK,sBAAsB;YAC5C,aAAa,KAAK,aAAa,CAAC,aAAa,CAAC,CAAC;QACnD,aAAa,KAAK,GAAG,EACrB,CAAC;QACD,2DAA2D;QAC3D,kEAAkE;QAClE,IACE,aAAa;YACb,CAAC,aAAa,CAAC,IAAI,KAAK,sBAAsB;gBAC5C,aAAa,KAAK,aAAa,CAAC,aAAa,CAAC,EAChD,CAAC;YACD,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,+DAA+D;QAC/D,8CAA8C;QAC9C,8EAA8E;QAC9E,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,uCAAuC;IACvC,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxC,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,eAAe,gCAAgC,CAAC"}
Binary file
Binary file
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import slangParse from './slangSolidityParser.js';
9
9
  import slangPrint from './slangPrinter.js';
10
10
  import { isComment, isBlockComment } from './slang-utils/is-comment.js';
11
11
  import { locEnd, locStart } from './slang-utils/loc.js';
12
- const slangParserId = 'slang-solidity';
13
- const antlrParserId = 'solidity-parse';
12
+ const slangParserId = 'slang';
13
+ const antlrParserId = 'antlr';
14
14
  const slangAstId = 'slang-ast';
15
- const antlrAstId = 'solidity-ast';
15
+ const antlrAstId = 'antlr-ast';
16
16
  // https://prettier.io/docs/en/plugins.html#languages
17
17
  // https://github.com/github-linguist/linguist/blob/master/lib/linguist/languages.yml
18
18
  const languages = [
@@ -38,7 +38,7 @@ const parsers = {
38
38
  [slangParserId]: slangParser,
39
39
  [antlrParserId]: antlrParser
40
40
  };
41
- const solidityCanAttachComment = (node) => typeof node.type === 'string' &&
41
+ const antlrCanAttachComment = (node) => typeof node.type === 'string' &&
42
42
  node.type !== 'BlockComment' &&
43
43
  node.type !== 'LineComment';
44
44
  const canAttachComment = (node) => typeof node !== 'string' &&
@@ -47,7 +47,7 @@ const canAttachComment = (node) => typeof node !== 'string' &&
47
47
  !isComment(node);
48
48
  // https://prettier.io/docs/en/plugins.html#printers
49
49
  const antlrPrinter = {
50
- canAttachComment: solidityCanAttachComment,
50
+ canAttachComment: antlrCanAttachComment,
51
51
  handleComments: {
52
52
  ownLine: comments.solidityHandleOwnLineComment,
53
53
  endOfLine: comments.solidityHandleEndOfLineComment,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,cAAc,MAAM,YAAY,CAAC;AACxC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAUxD,MAAM,aAAa,GAAG,gBAAgB,CAAC;AACvC,MAAM,aAAa,GAAG,gBAAgB,CAAC;AACvC,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC,qDAAqD;AACrD,qFAAqF;AACrF,MAAM,SAAS,GAAsB;IACnC;QACE,kBAAkB,EAAE,SAAS;QAC7B,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,MAAM;QACf,OAAO,E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c;IACd,cAAc;IACd,KAAK,EAAE,UAAU;IACjB,YAAY;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG;IACf,CAAC,UAAU,CAAC,EAAE,YAAY;IAC1B,CAAC,UAAU,CAAC,EAAE,YAAY;CAC3B,CAAC;AAEF,0DAA0D;AAC1D,MAAM,cAAc,GAA6B;IAC/C,cAAc,EAAE,KAAK;IACrB,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,14 +1,34 @@
1
1
  import { doc } from 'prettier';
2
2
  import { printComments, printPreservingEmptyLines, printSeparatedItem, printSeparatedList } from '../common/printer-helpers.js';
3
- const { group, line, hardline } = doc.builders;
4
- const inheritance = (node, path, print) => node.baseContracts.length > 0
5
- ? [
6
- ' is',
7
- printSeparatedList(path.map(print, 'baseContracts'), {
8
- firstSeparator: line
9
- })
10
- ]
11
- : line;
3
+ const { group, hardline, ifBreak, line, softline } = doc.builders;
4
+ const specifiers = (node, path, print) => {
5
+ const document = [];
6
+ if (node.baseContracts.length > 0) {
7
+ document.push([
8
+ 'is',
9
+ printSeparatedList(path.map(print, 'baseContracts'), {
10
+ firstSeparator: line
11
+ })
12
+ ]);
13
+ }
14
+ if (node.storageLayout) {
15
+ document.push([
16
+ 'layout at',
17
+ printSeparatedItem(path.call(print, 'storageLayout'), {
18
+ firstSeparator: line
19
+ })
20
+ ]);
21
+ }
22
+ if (document.length === 0)
23
+ return line;
24
+ if (document.length === 1)
25
+ return [' ', document];
26
+ const groupId = Symbol('ContractSpecifiers.inheritance');
27
+ return printSeparatedList([group(document[0], { id: groupId }), document[1]], {
28
+ firstSeparator: line,
29
+ separator: ifBreak('', softline, { groupId })
30
+ });
31
+ };
12
32
  const body = (node, path, options, print) => {
13
33
  const comments = printComments(node, path, options);
14
34
  return node.subNodes.length > 0 || (comments === null || comments === void 0 ? void 0 : comments.length)
@@ -21,7 +41,7 @@ export const ContractDefinition = {
21
41
  node.kind === 'abstract' ? 'abstract contract' : node.kind,
22
42
  ' ',
23
43
  node.name,
24
- inheritance(node, path, print),
44
+ specifiers(node, path, print),
25
45
  '{'
26
46
  ]),
27
47
  body(node, path, options, print),
@@ -1 +1 @@
1
- {"version":3,"file":"ContractDefinition.js","sourceRoot":"","sources":["../../src/nodes/ContractDefinition.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;AAE/C,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CACxC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC;IAC3B,CAAC,CAAC;QACE,KAAK;QACL,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,eAAe,CAAC,EAAE;YACnD,cAAc,EAAE,IAAI;SACrB,CAAC;KACH;IACH,CAAC,CAAC,IAAI,CAAC;AAEX,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;IAC1C,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,KAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA;QACjD,CAAC,CAAC,kBAAkB,CAChB,CAAC,yBAAyB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,EACvE,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,E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CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QACzC,KAAK,CAAC;YACJ,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;YAC1D,GAAG;YACH,IAAI,CAAC,IAAI;YACT,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;YAC7B,GAAG;SACJ,CAAC;QACF,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC;QAChC,GAAG;KACJ;CACF,CAAC"}
package/dist/printer.js CHANGED
@@ -12,7 +12,7 @@ function once(factory) {
12
12
  };
13
13
  }
14
14
  const warnDeprecation = once(() => {
15
- printWarning(`'solidity-parse' has been deprecated, please use 'slang-solidity'.`);
15
+ printWarning(`The 'antlr' parser has been deprecated, please use 'slang' instead.`);
16
16
  return true;
17
17
  });
18
18
  function genericPrint(path, options, print) {
@@ -1 +1 @@
1
- {"version":3,"file":"printer.js","sourceRoot":"","sources":["../src/printer.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAElD,SAAS,IAAI,CAAC,OAAO;IACnB,IAAI,KAAK,CAAC;IACV,OAAO,GAAG,EAAE;QACV,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;YACjC,KAAK,GAAG,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,CAAC,GA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;IACV,OAAO,GAAG,EAAE;QACV,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;YACjC,KAAK,GAAG,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE;IAChC,YAAY,CACV,qEAAqE,CACtE,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,SAAS,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK;IACxC,eAAe,EAAE,CAAC;IAElB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7B,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,cAAc,CAAC,IAAI,CAAC,CAAC;QAErB,OAAO,OAAO,CAAC,YAAY,CAAC,KAAK,CAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EACtB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CACzB,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -8,9 +8,9 @@ export default function handleContractDefinitionComments({ text, precedingNode,
8
8
  return false;
9
9
  }
10
10
  const nextCharacter = util.getNextNonSpaceNonCommentCharacter(text, locEnd(comment));
11
- // Everything before the InheritanceSpecifier is pushed onto the beginning of
11
+ // Everything before the ContractSpecifiers is pushed onto the beginning of
12
12
  // the ContractDefinition.
13
- if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.kind) === NonterminalKind.InheritanceSpecifier ||
13
+ if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.kind) === NonterminalKind.ContractSpecifiers ||
14
14
  ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.kind) === NonterminalKind.ContractMembers &&
15
15
  nextCharacter !== '{')) {
16
16
  addLeadingComment(enclosingNode, comment);
@@ -23,12 +23,22 @@ export default function handleContractDefinitionComments({ text, precedingNode,
23
23
  }
24
24
  // The last comments before the body.
25
25
  if (nextCharacter === '{') {
26
- // If there's an InheritanceSpecifier, the comment is appended to the last
27
- // InheritanceType.
28
- if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.kind) === NonterminalKind.InheritanceSpecifier &&
29
- precedingNode.types.items.length > 0) {
30
- addTrailingComment(precedingNode.types.items[precedingNode.types.items.length - 1], comment);
31
- return true;
26
+ if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.kind) === NonterminalKind.ContractSpecifiers) {
27
+ if (precedingNode.items.length === 0) {
28
+ addTrailingComment(precedingNode, comment);
29
+ return true;
30
+ }
31
+ const lastContractSpecifier = precedingNode.items[precedingNode.items.length - 1].variant;
32
+ // If the last ContractSpecifier's an InheritanceSpecifier, the comment
33
+ // is appended to the last InheritanceType.
34
+ if (lastContractSpecifier.kind === NonterminalKind.InheritanceSpecifier) {
35
+ addCollectionNodeLastComment(lastContractSpecifier.types, comment);
36
+ return true;
37
+ }
38
+ if (lastContractSpecifier.kind === NonterminalKind.StorageLayoutSpecifier) {
39
+ addTrailingComment(lastContractSpecifier.expression, comment);
40
+ return true;
41
+ }
32
42
  }
33
43
  }
34
44
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"handle-contract-definition-comments.js","sourceRoot":"","sources":["../../../src/slang-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EAA0E;QAC1E,mBAAmB;QACnB,IACE,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,eAAe,CAAC,oBAAoB;YAC5D,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EACpC,CAAC;YACD,kBAAkB,CAChB,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAC/D,OAAO,CACR,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"handle-contract-definition-comments.js","sourceRoot":"","sources":["../../../src/slang-comments/handlers/handle-contract-definition-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,4BAA4B,MAAM,uCAAuC,CAAC;AAIjF,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;AAEvD,MAAM,CAAC,OAAO,UAAU,gCAAgC,CAAC,EACvD,IAAI,EACJ,aAAa,EACb,aAAa,EACb,aAAa,EACb,OAAO,EACO;IACd,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,eAAe,CAAC,kBAAkB,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,kCAAkC,CAC3D,IAAI,EACJ,MAAM,CAAC,OAAO,CAAC,CAChB,CAAC;IAEF,2EAA2E;IAC3E,0BAA0B;IAC1B,IACE,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,eAAe,CAAC,kBAAkB;QAC1D,CAAC,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O,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { NonterminalKind } from '@nomicfoundation/slang/cst';
2
+ import { util } from 'prettier';
3
+ import addCollectionNodeLastComment from './add-collection-node-last-comment.js';
4
+ const { addTrailingComment } = util;
5
+ export default function handleContractSpecifiersComments({ precedingNode, enclosingNode, comment }) {
6
+ if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.kind) !== NonterminalKind.ContractSpecifiers) {
7
+ return false;
8
+ }
9
+ if (precedingNode &&
10
+ precedingNode.kind === NonterminalKind.ContractSpecifier) {
11
+ if (precedingNode.variant.kind === NonterminalKind.InheritanceSpecifier) {
12
+ addCollectionNodeLastComment(precedingNode.variant.types, comment);
13
+ return true;
14
+ }
15
+ if (precedingNode.variant.kind === NonterminalKind.StorageLayoutSpecifier) {
16
+ addTrailingComment(precedingNode.variant.expression, comment);
17
+ return true;
18
+ }
19
+ }
20
+ return false;
21
+ }
22
+ //# sourceMappingURL=handle-contract-specifiers-comments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-contract-specifiers-comments.js","sourceRoot":"","sources":["../../../src/slang-comments/handlers/handle-contract-specifiers-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,4BAA4B,MAAM,uCAAuC,CAAC;AAIjF,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;AAEpC,MAAM,CAAC,OAAO,UAAU,gCAAgC,CAAC,EACvD,aAAa,EACb,aAAa,EACb,OAAO,EACO;IACd,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,eAAe,CAAC,kBAAkB,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IACE,aAAa;QACb,aAAa,CAAC,IAAI,KAAK,eAAe,CAAC,iBAAiB,EACxD,CAAC;QACD,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,oBAAoB,EAAE,CAAC;YACxE,4BAA4B,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,sBAAsB,EAAE,CAAC;YAC1E,kBAAkB,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { NonterminalKind } from '@nomicfoundation/slang/cst';
2
+ import { util } from 'prettier';
3
+ const { addLeadingComment } = util;
4
+ export default function handleStorageLayoutSpecifierComments({ enclosingNode, followingNode, comment }) {
5
+ if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.kind) !== NonterminalKind.StorageLayoutSpecifier) {
6
+ return false;
7
+ }
8
+ if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.kind) === NonterminalKind.Expression) {
9
+ addLeadingComment(followingNode, comment);
10
+ return true;
11
+ }
12
+ return false;
13
+ }
14
+ //# sourceMappingURL=handle-storage-layout-specifier-comments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-storage-layout-specifier-comments.js","sourceRoot":"","sources":["../../../src/slang-comments/handlers/handle-storage-layout-specifier-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhC,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAM,CAAC,OAAO,UAAU,oCAAoC,CAAC,EAC3D,aAAa,EACb,aAAa,EACb,OAAO,EACO;IACd,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,eAAe,CAAC,sBAAsB,EAAE,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,MAAK,eAAe,CAAC,UAAU,EAAE,CAAC;QACvD,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import handleBlockComments from './handle-block-comments.js';
2
2
  import handleContractDefinitionComments from './handle-contract-definition-comments.js';
3
+ import handleContractSpecifiersComments from './handle-contract-specifiers-comments.js';
3
4
  import handleElseBranchComments from './handle-else-branch-comments.js';
4
5
  import handleIfStatementComments from './handle-if-statement-comments.js';
5
6
  import handleInterfaceDefinitionComments from './handle-interface-definition-comments.js';
@@ -7,11 +8,13 @@ import handleLibraryDefinitionComments from './handle-library-definition-comment
7
8
  import handleModifierInvocationComments from './handle-modifier-invocation-comments.js';
8
9
  import handleParametersDeclarationComments from './handle-parameters-declaration-comments.js';
9
10
  import handlePositionalArgumentsDeclarationComments from './handle-positional-arguments-declaration-comments.js';
11
+ import handleStorageLayoutSpecifierComments from './handle-storage-layout-specifier-comments.js';
10
12
  import handleWhileStatementComments from './handle-while-statement-comments.js';
11
13
  import handleYulBlockComments from './handle-yul-block-comments.js';
12
14
  export default [
13
15
  handleBlockComments,
14
16
  handleContractDefinitionComments,
17
+ handleContractSpecifiersComments,
15
18
  handleElseBranchComments,
16
19
  handleIfStatementComments,
17
20
  handleInterfaceDefinitionComments,
@@ -19,6 +22,7 @@ export default [
19
22
  handleModifierInvocationComments,
20
23
  handleParametersDeclarationComments,
21
24
  handlePositionalArgumentsDeclarationComments,
25
+ handleStorageLayoutSpecifierComments,
22
26
  handleWhileStatementComments,
23
27
  handleYulBlockComments
24
28
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/slang-comments/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAC7D,OAAO,gCAAgC,MAAM,0CAA0C,CAAC;AACxF,OAAO,wBAAwB,MAAM,kCAAkC,CAAC;AACxE,OAAO,yBAAyB,MAAM,mCAAmC,CAAC;AAC1E,OAAO,iCAAiC,MAAM,2CAA2C,CAAC;AAC1F,OAAO,+BAA+B,MAAM,yCAAyC,CAAC;AACtF,OAAO,gCAAgC,MAAM,0CAA0C,CAAC;AACxF,OAAO,mCAAmC,MAAM,6CAA6C,CAAC;AAC9F,OAAO,4CAA4C,MAAM,uDAAuD,CAAC;AACjH,OAAO,4BAA4B,MAAM,sCAAsC,CAAC;AAChF,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AAEpE,eAAe;IACb,mBAAmB;IACnB,gCAAgC;IAChC,wBAAwB;IACxB,yBAAyB;IACzB,iCAAiC;IACjC,+BAA+B;IAC/B,gCAAgC;IAChC,mCAAmC;IACnC,4CAA4C;IAC5C,4BAA4B;IAC5B,sBAAsB;CACvB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/slang-comments/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAC7D,OAAO,gCAAgC,MAAM,0CAA0C,CAAC;AACxF,OAAO,gCAAgC,MAAM,0CAA0C,CAAC;AACxF,OAAO,wBAAwB,MAAM,kCAAkC,CAAC;AACxE,OAAO,yBAAyB,MAAM,mCAAmC,CAAC;AAC1E,OAAO,iCAAiC,MAAM,2CAA2C,CAAC;AAC1F,OAAO,+BAA+B,MAAM,yCAAyC,CAAC;AACtF,OAAO,gCAAgC,MAAM,0CAA0C,CAAC;AACxF,OAAO,mCAAmC,MAAM,6CAA6C,CAAC;AAC9F,OAAO,4CAA4C,MAAM,uDAAuD,CAAC;AACjH,OAAO,oCAAoC,MAAM,+CAA+C,CAAC;AACjG,OAAO,4BAA4B,MAAM,sCAAsC,CAAC;AAChF,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AAEpE,eAAe;IACb,mBAAmB;IACnB,gCAAgC;IAChC,gCAAgC;IAChC,wBAAwB;IACxB,yBAAyB;IACzB,iCAAiC;IACjC,+BAA+B;IAC/B,gCAAgC;IAChC,mCAAmC;IACnC,4CAA4C;IAC5C,oCAAoC;IACpC,4BAA4B;IAC5B,sBAAsB;CACvB,CAAC"}
@@ -15,16 +15,13 @@ function experimentalTernaries(node, path, print, options) {
15
15
  const grandparent = path.getNode(2);
16
16
  const isNested = grandparent.kind === NonterminalKind.ConditionalExpression;
17
17
  const isNestedAsTrueExpression = isNested && grandparent.trueExpression.variant === node;
18
- const falseExpressionInSameLine = typeof node.falseExpression.variant !== 'string' &&
19
- (node.falseExpression.variant.kind === NonterminalKind.TupleExpression ||
20
- node.falseExpression.variant.kind ===
21
- NonterminalKind.ConditionalExpression);
18
+ const falseExpressionInSameLine = node.falseExpression.variant.kind === NonterminalKind.TupleExpression ||
19
+ node.falseExpression.variant.kind === NonterminalKind.ConditionalExpression;
22
20
  // If the `condition` breaks into multiple lines, we add parentheses,
23
21
  // unless it already is a `TupleExpression`.
24
22
  const operand = path.call(print, 'operand');
25
23
  const operandDoc = group([
26
- typeof node.operand.variant !== 'string' &&
27
- node.operand.variant.kind === NonterminalKind.TupleExpression
24
+ node.operand.variant.kind === NonterminalKind.TupleExpression
28
25
  ? operand
29
26
  : ifBreak(['(', printSeparatedItem(operand), ')'], operand),
30
27
  ' ?'
@@ -89,13 +86,10 @@ export class ConditionalExpression {
89
86
  // We can remove parentheses only because we are sure that the
90
87
  // `condition` must be a single `bool` value.
91
88
  const operandLoc = this.operand.loc;
92
- while (typeof this.operand.variant !== 'string' &&
93
- this.operand.variant.kind === NonterminalKind.TupleExpression &&
89
+ while (this.operand.variant.kind === NonterminalKind.TupleExpression &&
94
90
  this.operand.variant.items.items.length === 1 &&
95
- (typeof this.operand.variant.items.items[0].expression.variant ===
96
- 'string' ||
97
- this.operand.variant.items.items[0].expression.variant.kind !==
98
- NonterminalKind.ConditionalExpression)) {
91
+ this.operand.variant.items.items[0].expression.variant.kind !==
92
+ NonterminalKind.ConditionalExpression) {
99
93
  this.operand = this.operand.variant.items.items[0].expression;
100
94
  }
101
95
  this.operand.loc = operandLoc;
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionalExpression.js","sourceRoot":"","sources":["../../src/slang-nodes/ConditionalExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;AAE1E,SAAS,OAAO,CAAC,OAA+B;IAC9C,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IACjC,6EAA6E;IAC7E,SAAS;IACT,OAAO,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACvE,CAAC;AAED,SAAS,qBAAqB,CAC5B,IAA2B,EAC3B,IAAoC,EACpC,KAAoB,EACpB,OAA+B;IAE/B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAkB,CAAC;IACrD,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,KAAK,eAAe,CAAC,qBAAqB,CAAC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