IR attribute arg prioritization and general readme updates

This commit is contained in:
davidsemakula 2023-04-22 11:16:27 +03:00
parent 70563414ad
commit 27d76b8aa3
4 changed files with 14 additions and 11 deletions

View file

@ -42,14 +42,18 @@ Or you can access documentation locally by running the following command from th
cargo doc --open
```
To open crate specific docs, see instructions in the readme in each crate's directory.
## Testing
You can run unit tests for all the core functionality by running the following command from the project root
You can run unit tests for all the core functionality for all crates by running the following command from the project root
```shell
cargo test
```
To run only crate specific tests, see instructions in the readme in each crate's directory.
## License
This code is released under both MIT and Apache-2.0 licenses.

View file

@ -2,8 +2,6 @@
[ink!](https://use.ink/) intermediate representations (IRs) and abstractions for [ink! analyzer](/crates/analyzer).
**NOTE:** This project is still work in progress, check back over the next few weeks for regular updates.
## Installation
Run the following Cargo command in your project directory

View file

@ -35,19 +35,22 @@ pub fn sort_ink_args_by_kind(args: &[InkArg]) -> Vec<InkArg> {
| InkArgKind::Impl
| InkArgKind::Message
| InkArgKind::Storage => 0,
// Optional (e.g `anonymous`, `payable`, `selector` e.t.c) and/or non root-level (e.g `topic`)
// and/or ambiguous (e.g `namespace`) get the next tier.
// Everything else apart from "unknown" gets the next priority level.
// This includes optional (e.g `anonymous`, `payable`, `selector` e.t.c) and/or non root-level (e.g `topic`)
// and/or ambiguous (e.g `namespace`) and/or macro-level arguments (e.g `env`, `keep_attr`, `derive` e.t.c).
// This group is explicitly enumerated to force explicit decisions about
// the priority level of new `InkArgKind` additions.
InkArgKind::Anonymous
| InkArgKind::Default
| InkArgKind::Derive
| InkArgKind::Env
| InkArgKind::HandleStatus
| InkArgKind::KeepAttr
| InkArgKind::Namespace
| InkArgKind::Payable
| InkArgKind::Selector
| InkArgKind::Topic => 1,
// Macro-only arguments get the next priority level.
InkArgKind::Env | InkArgKind::KeepAttr | InkArgKind::Derive => 2,
// Everything else gets the lowest priority.
// Unknown gets a special tier.
// "Unknown" gets a special priority level.
InkArgKind::Unknown => 10,
}
});

View file

@ -2,8 +2,6 @@
Procedural macros for [ink-analyzer](/crates/analyzer) and [ink-analyzer-ir](/crates/ir).
**NOTE:** This project is still work in progress, check back over the next few weeks for regular updates.
## Installation
Run the following Cargo command in your project directory