Skip to content

Add constant support for windows-rdl#3882

Merged
kennykerr merged 2 commits intomasterfrom
rdl-const
Feb 10, 2026
Merged

Add constant support for windows-rdl#3882
kennykerr merged 2 commits intomasterfrom
rdl-const

Conversation

@kennykerr
Copy link
Copy Markdown
Collaborator

Building on #3861, this update adds parsing support for Win32-style constants. Here's an example of a .rdl definition:

mod Sample {
    const D3D12_MAJOR_VERSION: u32 = 12;
    const D3D12_MINOR_VERSION: u32 = 0;
}

Much like #3873, ECMA-335 doesn't support what it calls "fields" without an associated type. Win32-style constants are thus also added to the per-namespace "Apis" type:

.class public auto ansi sealed Sample.Apis
	extends [mscorlib]System.Object
{
	.field public static literal uint32 D3D12_MAJOR_VERSION = uint32(12)
	.field public static literal uint32 D3D12_MINOR_VERSION = uint32(0)

}

So far it only handles integer constants. Support for string and struct literal constants coming soon.

@kennykerr kennykerr merged commit 3ddd8f7 into master Feb 10, 2026
32 checks passed
@kennykerr kennykerr deleted the rdl-const branch February 10, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants