Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

address review comments

author
Giacomo Cavalieri
committer
Louis Pilfold
date (Nov 24, 2025, 11:56 AM UTC) commit a7953f2b parent ca0d259c change-id txuyzuuv
+32 -20
+1 -1
compiler-cli/src/publish.rs
··· 142 142 return Ok(()); 143 143 } 144 144 145 - if module.ast.count_definitions() > 2 { 145 + if module.ast.definitions_len() > 2 { 146 146 return Ok(()); 147 147 } 148 148
+1 -1
compiler-core/src/ast.rs
··· 96 96 .find_map(|function| function.find_statement(byte_index)) 97 97 } 98 98 99 - pub fn count_definitions(&self) -> usize { 99 + pub fn definitions_len(&self) -> usize { 100 100 let TypedDefinitions { 101 101 imports, 102 102 constants,
+2 -2
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__generics__task_typescript.snap
··· 7 7 pub type Task(a) = fn() -> Promise(a) 8 8 9 9 ----- TYPESCRIPT DEFINITIONS 10 - export type Task = () => Promise$<any>; 11 - 12 10 export type Promise$<I> = any; 11 + 12 + export type Task = () => Promise$<any>;
+6 -6
compiler-core/src/javascript/typescript.rs
··· 349 349 fn definitions(&mut self, imports: &mut Imports<'_>) -> Vec<Document<'a>> { 350 350 let mut documents = vec![]; 351 351 352 - for type_alias in &self.module.definitions.type_aliases { 353 - if let Some(document) = self.type_alias(type_alias) { 354 - documents.push(document); 355 - } 356 - } 357 - 358 352 for custom_type in &self.module.definitions.custom_types { 359 353 if let Some(mut new_documents) = self.custom_type_definition(custom_type, imports) { 360 354 documents.append(&mut new_documents); 355 + } 356 + } 357 + 358 + for type_alias in &self.module.definitions.type_aliases { 359 + if let Some(document) = self.type_alias(type_alias) { 360 + documents.push(document); 361 361 } 362 362 } 363 363
+19 -4
compiler-core/src/language_server/code_action.rs
··· 1827 1827 module_name: &EcoString, 1828 1828 constructor_name: &EcoString, 1829 1829 ) { 1830 - self.unqualified_constructor = (self.module.ast.definitions.imports) 1830 + self.unqualified_constructor = self 1831 + .module 1832 + .ast 1833 + .definitions 1834 + .imports 1831 1835 .iter() 1832 1836 .filter(|import| import.module == *module_name) 1833 1837 .find_map(|import| { ··· 1847 1851 1848 1852 fn get_module_import_from_type_constructor(&mut self, constructor_name: &EcoString) { 1849 1853 self.unqualified_constructor = 1850 - (self.module.ast.definitions.imports) 1854 + self.module 1855 + .ast 1856 + .definitions 1857 + .imports 1851 1858 .iter() 1852 1859 .find_map(|import| { 1853 1860 if let Some(ty) = import ··· 7582 7589 /// unqualified values it's importing. Sorted by SrcSpan location. 7583 7590 /// 7584 7591 fn imported_values(&self, import_location: SrcSpan) -> Vec<SrcSpan> { 7585 - (self.module.ast.definitions.imports) 7592 + self.module 7593 + .ast 7594 + .definitions 7595 + .imports 7586 7596 .iter() 7587 7597 .find(|import| import.location.contains(import_location.start)) 7588 7598 .map(|import| { ··· 7603 7613 return vec![]; 7604 7614 } 7605 7615 7606 - let unused_imports = (self.module.ast.type_info.warnings.iter()) 7616 + let unused_imports = self 7617 + .module 7618 + .ast 7619 + .type_info 7620 + .warnings 7621 + .iter() 7607 7622 .filter_map(|warning| match warning { 7608 7623 type_::Warning::UnusedImportedValue { location, .. } => { 7609 7624 Some(UnusedImport::ValueOrType(*location))
+1 -4
compiler-core/src/language_server/edits.rs
··· 32 32 .chain(custom_types.iter().map(|custom_type| custom_type.location)) 33 33 .chain(type_aliases.iter().map(|type_alias| type_alias.location)) 34 34 .chain(functions.iter().map(|function| function.location)) 35 - .filter(|location| location.lt(&first_import.location)) 36 - .peekable() 37 - .peek() 38 - .is_none(); 35 + .all(|location| location >= first_import.location); 39 36 40 37 if import_is_first_definition { 41 38 Some(src_span_to_lsp_range(first_import.location, line_numbers).start)
+1 -1
compiler-core/src/language_server/tests/hover.rs
··· 30 30 if current_position == position { 31 31 underline_empty = false; 32 32 underline.push('↑'); 33 - } else if start.le(&current_position) && current_position.lt(&end) { 33 + } else if start <= current_position && current_position < end { 34 34 underline_empty = false; 35 35 underline.push('▔'); 36 36 } else {
+1 -1
compiler-core/src/language_server/tests/reference.rs
··· 57 57 if Some(current_position) == position { 58 58 underline_empty = false; 59 59 underline.push('↑'); 60 - } else if start.le(&current_position) && current_position.lt(&end) { 60 + } else if start <= &current_position && current_position < *end { 61 61 underline_empty = false; 62 62 underline.push('▔'); 63 63 } else {