Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fb83252

Browse filesBrowse files
bors[bot]korken89
andauthored
Merge #44
44: Added type aliases to the App struct r=korken89 a=korken89 Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2 parents 4ba916d + 028509e commit fb83252
Copy full SHA for fb83252

File tree

Expand file treeCollapse file tree

4 files changed

+15
-7
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+15
-7
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1717

1818
- Improved ergonomics allowing separation of task signatures to actual implementation in extern block `extern "Rust" { #[task(..)] fn t(..); }`.
1919

20+
- Added type alias definitions to the `App` struct.
21+
2022

2123
### Changed
2224

2325
- [breaking-change] Move of dispatchers (interrupts) from `extern` to app arguments.
24-
`app(..., dispatchers = [SSI0,...])`
26+
`app(..., dispatchers = [SSI0,...])`
2527
This should also work for ram functions and other attributes, see `examples/ramfunc.rs`.
2628

2729
- [breaking-change] Rework whole spawn/schedule, support `foo::spawn( ... )`,

‎Cargo.toml

Copy file name to clipboardExpand all lines: Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ keywords = []
1111
license = "MIT OR Apache-2.0"
1212
name = "rtic-syntax"
1313
repository = "https://github.com/rtic-rs/rtic-syntax"
14-
version = "0.5.0-alpha.1"
14+
version = "0.5.0-alpha.2"
1515

1616
[dependencies]
1717
indexmap = "1.0.2"

‎src/ast.rs

Copy file name to clipboardExpand all lines: src/ast.rs
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use core::ops::Deref;
44

5-
use syn::{Attribute, Expr, Ident, Item, ItemUse, Pat, PatType, Path, Stmt, Type};
5+
use syn::{Attribute, Expr, Ident, Item, ItemType, ItemUse, Pat, PatType, Path, Stmt, Type};
66

77
use crate::{Map, Set};
88

@@ -37,6 +37,9 @@ pub struct App {
3737
/// User code
3838
pub user_code: Vec<Item>,
3939

40+
/// User types
41+
pub user_types: Vec<ItemType>,
42+
4043
/// Hardware tasks: `#[task(binds = ..)]`s
4144
pub hardware_tasks: Map<HardwareTask>,
4245

‎src/parse/app.rs

Copy file name to clipboardExpand all lines: src/parse/app.rs
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ impl App {
149149
let mut software_tasks = Map::new();
150150
let mut user_imports = vec![];
151151
let mut user_code = vec![];
152+
let mut user_types = vec![];
152153

153154
let mut seen_idents = HashSet::<Ident>::new();
154155
let mut bindings = HashSet::<Ident>::new();
@@ -422,8 +423,7 @@ impl App {
422423
user_imports.push(itemuse_.clone());
423424
}
424425
Item::Type(ref mut type_item) => {
425-
// Match structures with the attribute #[resources], name of structure is not
426-
// important
426+
// Match structures with the attribute #[monotonic]
427427
if let Some(pos) = type_item
428428
.attrs
429429
.iter()
@@ -455,9 +455,11 @@ impl App {
455455

456456
monotonics.insert(type_item.ident.clone(), monotonic);
457457
} else {
458-
// Structure without the #[resources] attribute should just be passed along
459-
user_code.push(item.clone());
458+
// Pass along any other type aliases
459+
user_types.push(type_item.clone());
460460
}
461+
462+
user_code.push(item.clone());
461463
}
462464
_ => {
463465
// Anything else within the module should not make any difference
@@ -479,6 +481,7 @@ impl App {
479481
resources,
480482
user_imports,
481483
user_code,
484+
user_types,
482485
hardware_tasks,
483486
software_tasks,
484487
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.