Skip to content

Commit 22bcb36

Browse files
authored
Fixing casing of wit ids (#1412)
Implements the fix from #1410 (review) Co-authored-by: @OmarTawfik
1 parent 611f785 commit 22bcb36

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

crates/infra/utils/src/codegen/tera.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,17 @@ fn wit_case_filter(value: &Value, args: &HashMap<String, Value>) -> tera::Result
172172
let mut result = String::new();
173173
result.push('%');
174174

175-
let mut last_was_upper = true;
176-
for c in input.chars() {
175+
for (i, c) in input.chars().enumerate() {
177176
if c.is_uppercase() {
178-
if !last_was_upper {
177+
if i > 0 {
179178
result.push('-');
180179
}
181-
last_was_upper = true;
182180
for c in c.to_lowercase() {
183181
result.push(c);
184182
}
185183
} else if c.is_alphanumeric() {
186-
last_was_upper = false;
187184
result.push(c);
188185
} else {
189-
last_was_upper = false;
190186
result.push('-');
191187
}
192188
}

crates/solidity/outputs/cargo/wasm/src/generated/interface/generated/cst.wit

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)