Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2949,13 +2949,25 @@ jobs:
run: |
set -euo pipefail
"$WAVE_TOOLS" prepare host --target "$WAVE_CI_TARGET" --provision
- name: Select pinned FreeBSD input cache
id: freebsd-cache
shell: bash
timeout-minutes: 5
run: '"$WAVE_TOOLS" freebsd cache-key --github-output "$GITHUB_OUTPUT"'
- name: Restore pinned FreeBSD inputs from the package cache
uses: actions/cache/restore@v5
with:
path: ${{ steps.freebsd-cache.outputs.path }}
key: ${{ steps.freebsd-cache.outputs.key }}
- name: Fetch and verify pinned FreeBSD image
id: image
shell: bash
timeout-minutes: 30
env:
IMAGE_CACHE: ${{ steps.freebsd-cache.outputs.path }}
run: |
set -euo pipefail
"$WAVE_TOOLS" freebsd fetch-image --work-dir "$RUNNER_TEMP" --provision --github-env "$GITHUB_ENV"
"$WAVE_TOOLS" freebsd fetch-image --cache "$IMAGE_CACHE" --work-dir "$RUNNER_TEMP" --provision --github-env "$GITHUB_ENV"
- name: Build compiler and validate VM reporting
id: compiler
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wavec"
version = "0.0.1-alpha-dev"
version = "0.0.1-alpha"
edition = "2021"

[lib]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Wave is not a C dialect and does not aim for C source compatibility. It is a new
- **Cross-target compilation.** Generate code for x86-64, AArch64, RISC-V 64, LoongArch64, and WebAssembly from supported compiler hosts.
- **Tool-friendly interfaces.** Query targets and compiler capabilities in human-readable or JSON form for build tools and editors.

Wave is under active alpha development (`0.0.1-alpha-dev`). Syntax and toolchain contracts are being stabilized and may still change between releases.
The current compiler version is `0.0.1-alpha`. Syntax and toolchain contracts are being stabilized and may still change between releases.

## A first Wave program

Expand Down Expand Up @@ -295,7 +295,7 @@ compiler-diagnostic stream.

## Experimental Whale backend

Development is now `0.0.1-alpha-dev`. LLVM remains the default backend. The
LLVM is the default backend in `0.0.1-alpha`. The
existing `--whale` flag selects the initial Linux amd64, O0 integration:

```shell
Expand Down
6 changes: 2 additions & 4 deletions VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ example, after the final `pre-beta` release, the first `alpha` release starts at

`v0.2.1-pre-beta` is the final public `pre-beta` release.

The repository uses `v0.0.1-alpha-dev` while LLVM and Whale integration is under
development. LLVM remains the default backend; Whale is selected explicitly
with `--whale`. The `-dev` suffix is removed when the release is ready to publish
as `v0.0.1-alpha`.
The repository version for the first alpha is `v0.0.1-alpha`. LLVM remains the
default backend. Select Whale explicitly with `--whale`.

The stage transition resets the release counter. Installers must determine the
latest published release by publication order, not by comparing version numbers.
Expand Down
2 changes: 2 additions & 0 deletions front/hir/src/async_lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ fn function(
) -> FunctionNode {
FunctionNode {
is_async: false,
member_access: None,
span: None,
name,
generic_params: vec![],
Expand Down Expand Up @@ -679,6 +680,7 @@ fn emit_frame(
name: frame_name,
generic_params: vec![],
field_spans: vec![None; fields.len()],
field_access: Vec::new(),
fields,
methods: vec![],
visibility: Visibility::Private,
Expand Down
1 change: 1 addition & 0 deletions front/hir/tests/named_proto_boundary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fn syntax(source: &str) -> Vec<parser::ast::ASTNode> {
fn named_contracts_are_rejected_at_the_semantic_boundary_with_a_span() {
for source in [
"struct Buffer {} proto MissingContract: Buffer { fun value(self) -> i32 { return 7; } } fun main() {}",
"struct Buffer {} proto graphics::Renderer: Buffer { fun draw(self) {} } fun main() {}",
"struct Buffer {} proto First: Buffer { fun value(self) -> i32 { return 7; } } proto Second: Buffer { fun value(self) -> i32 { return 8; } } fun main() {}",
] {
let error = TypedProgram::lower(syntax(source)).unwrap_err();
Expand Down
29 changes: 29 additions & 0 deletions front/parser/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ pub enum Visibility {
Public,
}

/// An explicit member modifier, independent of a declaration's module visibility.
#[derive(Debug, Clone)]
pub struct MemberAccess {
pub kind: MemberAccessKind,
pub span: Option<error::SourceSpan>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MemberAccessKind {
Public,
Private,
Protected,
}

impl MemberAccessKind {
pub fn spelling(self) -> &'static str {
match self {
Self::Public => "pub",
Self::Private => "priv",
Self::Protected => "protected",
}
}
}

#[derive(Debug, Clone)]
pub struct TypeAliasNode {
pub name: String,
Expand Down Expand Up @@ -107,6 +131,7 @@ pub struct VariantCaseNode {
#[derive(Debug, Clone)]
pub struct FunctionNode {
pub is_async: bool,
pub member_access: Option<Box<MemberAccess>>,
pub span: Option<error::SourceSpan>,
pub name: String,
pub generic_params: Vec<String>,
Expand All @@ -130,6 +155,8 @@ pub struct StructNode {
pub generic_params: Vec<String>,
pub fields: Vec<(String, WaveType)>,
pub field_spans: Vec<Option<error::SourceSpan>>,
/// Explicit modifiers keyed by index in `fields`. Unmarked fields have no entry.
pub field_access: Vec<(usize, MemberAccess)>,
pub methods: Vec<FunctionNode>,
pub visibility: Visibility,
}
Expand All @@ -138,6 +165,8 @@ pub struct StructNode {
pub struct ProtoImplNode {
/// Named contract, or None for the existing inherent proto form.
pub name: Option<String>,
/// One span per segment of a named contract, in source order. Empty for inherent proto.
pub contract_segment_spans: Vec<Option<error::SourceSpan>>,
/// The target name includes generic arguments, e.g. Buffer<i32>.
pub target: String,
pub methods: Vec<FunctionNode>,
Expand Down
3 changes: 3 additions & 0 deletions front/parser/src/ast/cloning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ fn take(nodes: &mut std::vec::IntoIter<ASTNode>, count: usize) -> Vec<ASTNode> {
fn function(n: &FunctionNode, nodes: &mut std::vec::IntoIter<ASTNode>) -> FunctionNode {
FunctionNode {
is_async: n.is_async,
member_access: n.member_access.clone(),
span: n.span.clone(),
name: n.name.clone(),
generic_params: n.generic_params.clone(),
Expand Down Expand Up @@ -130,11 +131,13 @@ impl Clone for ASTNode {
generic_params: n.generic_params.clone(),
fields: n.fields.clone(),
field_spans: n.field_spans.clone(),
field_access: n.field_access.clone(),
methods: n.methods.iter().map(|n| function(n, &mut nodes)).collect(),
visibility: n.visibility,
}),
ASTNode::ProtoImpl(n) => ASTNode::ProtoImpl(ProtoImplNode {
name: n.name.clone(),
contract_segment_spans: n.contract_segment_spans.clone(),
target: n.target.clone(),
methods: n.methods.iter().map(|n| function(n, &mut nodes)).collect(),
visibility: n.visibility,
Expand Down
32 changes: 26 additions & 6 deletions front/parser/src/ast_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl Data for VariantCaseNode {
}
impl Data for FunctionNode {
fn data(&self, cx: &Context) -> Value {
record(
let mut value = record(
"function",
vec![
("is_async", self.is_async.data(cx)),
Expand All @@ -293,7 +293,19 @@ impl Data for FunctionNode {
("export", self.export.data(cx)),
("visibility", self.visibility.data(cx)),
],
)
);
if let Some(access) = &self.member_access {
put(&mut value, "member_access", access.data(cx));
}
value
}
}
impl Data for MemberAccess {
fn data(&self, cx: &Context) -> Value {
Value::object([
("modifier", Value::string(self.kind.spelling())),
("span", self.span.data(cx)),
])
}
}
impl Data for ExportAttribute {
Expand All @@ -306,7 +318,7 @@ impl Data for ExportAttribute {
}
impl Data for StructNode {
fn data(&self, cx: &Context) -> Value {
record(
let mut value = record(
"struct",
vec![
("name", self.name.data(cx)),
Expand All @@ -316,20 +328,28 @@ impl Data for StructNode {
("methods", self.methods.data(cx)),
("visibility", self.visibility.data(cx)),
],
)
);
if !self.field_access.is_empty() {
put(&mut value, "field_access", self.field_access.data(cx));
}
value
}
}
impl Data for ProtoImplNode {
fn data(&self, cx: &Context) -> Value {
record(
let mut value = record(
"proto_impl",
vec![
("name", self.name.data(cx)),
("target", self.target.data(cx)),
("methods", self.methods.data(cx)),
("visibility", self.visibility.data(cx)),
],
)
);
if self.contract_segment_spans.len() > 1 {
put(&mut value, "contract_segment_spans", self.contract_segment_spans.data(cx));
}
value
}
}
impl Data for FunctionSignature {
Expand Down
1 change: 1 addition & 0 deletions front/parser/src/parser/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ fn parse_function_with_export_and_receiver(
let body = extract_body(tokens)?;
Ok(ASTNode::Function(FunctionNode {
is_async,
member_access: None,
span: lexer::consumed_span(before, tokens),
name,
generic_params,
Expand Down
Loading
Loading