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

Configure Feed

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

Add more information to references

+710 -23
+571 -6
compiler-core/generated/schema_capnp.rs
··· 1690 1690 !self.reader.get_pointer_field(1).is_null() 1691 1691 } 1692 1692 #[inline] 1693 - pub fn get_references(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema_capnp::src_span::Owned>> { 1693 + pub fn get_references(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema_capnp::reference::Owned>> { 1694 1694 ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) 1695 1695 } 1696 1696 #[inline] ··· 1784 1784 !self.builder.is_pointer_field_null(1) 1785 1785 } 1786 1786 #[inline] 1787 - pub fn get_references(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema_capnp::src_span::Owned>> { 1787 + pub fn get_references(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema_capnp::reference::Owned>> { 1788 1788 ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) 1789 1789 } 1790 1790 #[inline] 1791 - pub fn set_references(&mut self, value: ::capnp::struct_list::Reader<'_,crate::schema_capnp::src_span::Owned>) -> ::capnp::Result<()> { 1791 + pub fn set_references(&mut self, value: ::capnp::struct_list::Reader<'_,crate::schema_capnp::reference::Owned>) -> ::capnp::Result<()> { 1792 1792 ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(2), value, false) 1793 1793 } 1794 1794 #[inline] 1795 - pub fn init_references(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema_capnp::src_span::Owned> { 1795 + pub fn init_references(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema_capnp::reference::Owned> { 1796 1796 ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(2), size) 1797 1797 } 1798 1798 #[inline] ··· 1873 1873 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1874 1874 ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), 1875 1875 ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1876 - ::capnp::word(176, 122, 119, 83, 72, 147, 59, 230), 1876 + ::capnp::word(97, 111, 221, 187, 73, 147, 33, 194), 1877 1877 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1878 1878 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1879 1879 ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), ··· 1884 1884 match index { 1885 1885 0 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 1886 1886 1 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 1887 - 2 => <::capnp::struct_list::Owned<crate::schema_capnp::src_span::Owned> as ::capnp::introspect::Introspect>::introspect(), 1887 + 2 => <::capnp::struct_list::Owned<crate::schema_capnp::reference::Owned> as ::capnp::introspect::Introspect>::introspect(), 1888 1888 _ => panic!("invalid field index {}", index), 1889 1889 } 1890 1890 } ··· 1902 1902 pub static MEMBERS_BY_NAME : &[u16] = &[0,1,2]; 1903 1903 pub const TYPE_ID: u64 = 0xcd8d_a5aa_fa92_5d68; 1904 1904 } 1905 + } 1906 + 1907 + pub mod reference { 1908 + #[derive(Copy, Clone)] 1909 + pub struct Owned(()); 1910 + impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } 1911 + impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } 1912 + impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } 1913 + impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } 1914 + 1915 + pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } 1916 + impl <> ::core::marker::Copy for Reader<'_,> {} 1917 + impl <> ::core::clone::Clone for Reader<'_,> { 1918 + fn clone(&self) -> Self { *self } 1919 + } 1920 + 1921 + impl <> ::capnp::traits::HasTypeId for Reader<'_,> { 1922 + const TYPE_ID: u64 = _private::TYPE_ID; 1923 + } 1924 + impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { 1925 + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { 1926 + Self { reader, } 1927 + } 1928 + } 1929 + 1930 + impl <'a,> ::core::convert::From<Reader<'a,>> for ::capnp::dynamic_value::Reader<'a> { 1931 + fn from(reader: Reader<'a,>) -> Self { 1932 + Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) 1933 + } 1934 + } 1935 + 1936 + impl <> ::core::fmt::Debug for Reader<'_,> { 1937 + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { 1938 + core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) 1939 + } 1940 + } 1941 + 1942 + impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { 1943 + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { 1944 + ::core::result::Result::Ok(reader.get_struct(default)?.into()) 1945 + } 1946 + } 1947 + 1948 + impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { 1949 + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { 1950 + self.reader 1951 + } 1952 + } 1953 + 1954 + impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { 1955 + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { 1956 + self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) 1957 + } 1958 + } 1959 + 1960 + impl <'a,> Reader<'a,> { 1961 + pub fn reborrow(&self) -> Reader<'_,> { 1962 + Self { .. *self } 1963 + } 1964 + 1965 + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { 1966 + self.reader.total_size() 1967 + } 1968 + #[inline] 1969 + pub fn get_location(self) -> ::capnp::Result<crate::schema_capnp::src_span::Reader<'a>> { 1970 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) 1971 + } 1972 + #[inline] 1973 + pub fn has_location(&self) -> bool { 1974 + !self.reader.get_pointer_field(0).is_null() 1975 + } 1976 + #[inline] 1977 + pub fn get_kind(self) -> ::capnp::Result<crate::schema_capnp::reference_kind::Reader<'a>> { 1978 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) 1979 + } 1980 + #[inline] 1981 + pub fn has_kind(&self) -> bool { 1982 + !self.reader.get_pointer_field(1).is_null() 1983 + } 1984 + } 1985 + 1986 + pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } 1987 + impl <> ::capnp::traits::HasStructSize for Builder<'_,> { 1988 + const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 2 }; 1989 + } 1990 + impl <> ::capnp::traits::HasTypeId for Builder<'_,> { 1991 + const TYPE_ID: u64 = _private::TYPE_ID; 1992 + } 1993 + impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { 1994 + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { 1995 + Self { builder, } 1996 + } 1997 + } 1998 + 1999 + impl <'a,> ::core::convert::From<Builder<'a,>> for ::capnp::dynamic_value::Builder<'a> { 2000 + fn from(builder: Builder<'a,>) -> Self { 2001 + Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) 2002 + } 2003 + } 2004 + 2005 + impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { 2006 + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { 2007 + self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) 2008 + } 2009 + } 2010 + 2011 + impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { 2012 + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { 2013 + builder.init_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE).into() 2014 + } 2015 + fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { 2016 + ::core::result::Result::Ok(builder.get_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE, default)?.into()) 2017 + } 2018 + } 2019 + 2020 + impl <> ::capnp::traits::SetterInput<Owned<>> for Reader<'_,> { 2021 + fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } 2022 + } 2023 + 2024 + impl <'a,> Builder<'a,> { 2025 + pub fn into_reader(self) -> Reader<'a,> { 2026 + self.builder.into_reader().into() 2027 + } 2028 + pub fn reborrow(&mut self) -> Builder<'_,> { 2029 + Builder { builder: self.builder.reborrow() } 2030 + } 2031 + pub fn reborrow_as_reader(&self) -> Reader<'_,> { 2032 + self.builder.as_reader().into() 2033 + } 2034 + 2035 + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { 2036 + self.builder.as_reader().total_size() 2037 + } 2038 + #[inline] 2039 + pub fn get_location(self) -> ::capnp::Result<crate::schema_capnp::src_span::Builder<'a>> { 2040 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) 2041 + } 2042 + #[inline] 2043 + pub fn set_location(&mut self, value: crate::schema_capnp::src_span::Reader<'_>) -> ::capnp::Result<()> { 2044 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) 2045 + } 2046 + #[inline] 2047 + pub fn init_location(self, ) -> crate::schema_capnp::src_span::Builder<'a> { 2048 + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) 2049 + } 2050 + #[inline] 2051 + pub fn has_location(&self) -> bool { 2052 + !self.builder.is_pointer_field_null(0) 2053 + } 2054 + #[inline] 2055 + pub fn get_kind(self) -> ::capnp::Result<crate::schema_capnp::reference_kind::Builder<'a>> { 2056 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) 2057 + } 2058 + #[inline] 2059 + pub fn set_kind(&mut self, value: crate::schema_capnp::reference_kind::Reader<'_>) -> ::capnp::Result<()> { 2060 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(1), value, false) 2061 + } 2062 + #[inline] 2063 + pub fn init_kind(self, ) -> crate::schema_capnp::reference_kind::Builder<'a> { 2064 + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) 2065 + } 2066 + #[inline] 2067 + pub fn has_kind(&self) -> bool { 2068 + !self.builder.is_pointer_field_null(1) 2069 + } 2070 + } 2071 + 2072 + pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } 2073 + impl ::capnp::capability::FromTypelessPipeline for Pipeline { 2074 + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { 2075 + Self { _typeless: typeless, } 2076 + } 2077 + } 2078 + impl Pipeline { 2079 + pub fn get_location(&self) -> crate::schema_capnp::src_span::Pipeline { 2080 + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) 2081 + } 2082 + pub fn get_kind(&self) -> crate::schema_capnp::reference_kind::Pipeline { 2083 + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) 2084 + } 2085 + } 2086 + mod _private { 2087 + pub static ENCODED_NODE: [::capnp::Word; 48] = [ 2088 + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), 2089 + ::capnp::word(97, 111, 221, 187, 73, 147, 33, 194), 2090 + ::capnp::word(13, 0, 0, 0, 1, 0, 0, 0), 2091 + ::capnp::word(190, 237, 188, 253, 156, 169, 51, 181), 2092 + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), 2093 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2094 + ::capnp::word(21, 0, 0, 0, 186, 0, 0, 0), 2095 + ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), 2096 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2097 + ::capnp::word(25, 0, 0, 0, 119, 0, 0, 0), 2098 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2099 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2100 + ::capnp::word(115, 99, 104, 101, 109, 97, 46, 99), 2101 + ::capnp::word(97, 112, 110, 112, 58, 82, 101, 102), 2102 + ::capnp::word(101, 114, 101, 110, 99, 101, 0, 0), 2103 + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), 2104 + ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), 2105 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2106 + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), 2107 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2108 + ::capnp::word(41, 0, 0, 0, 74, 0, 0, 0), 2109 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2110 + ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), 2111 + ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), 2112 + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), 2113 + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), 2114 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2115 + ::capnp::word(49, 0, 0, 0, 42, 0, 0, 0), 2116 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2117 + ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), 2118 + ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), 2119 + ::capnp::word(108, 111, 99, 97, 116, 105, 111, 110), 2120 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2121 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 2122 + ::capnp::word(176, 122, 119, 83, 72, 147, 59, 230), 2123 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2124 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2125 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 2126 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2127 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2128 + ::capnp::word(107, 105, 110, 100, 0, 0, 0, 0), 2129 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 2130 + ::capnp::word(201, 38, 14, 81, 37, 76, 28, 166), 2131 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2132 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2133 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 2134 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2135 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2136 + ]; 2137 + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { 2138 + match index { 2139 + 0 => <crate::schema_capnp::src_span::Owned as ::capnp::introspect::Introspect>::introspect(), 2140 + 1 => <crate::schema_capnp::reference_kind::Owned as ::capnp::introspect::Introspect>::introspect(), 2141 + _ => panic!("invalid field index {}", index), 2142 + } 2143 + } 2144 + pub fn get_annotation_types(child_index: Option<u16>, index: u32) -> ::capnp::introspect::Type { 2145 + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) 2146 + } 2147 + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { 2148 + encoded_node: &ENCODED_NODE, 2149 + nonunion_members: NONUNION_MEMBERS, 2150 + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, 2151 + members_by_name: MEMBERS_BY_NAME, 2152 + }; 2153 + pub static NONUNION_MEMBERS : &[u16] = &[0,1]; 2154 + pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; 2155 + pub static MEMBERS_BY_NAME : &[u16] = &[1,0]; 2156 + pub const TYPE_ID: u64 = 0xc221_9349_bbdd_6f61; 2157 + } 2158 + } 2159 + 2160 + pub mod reference_kind { 2161 + pub use self::Which::{Qualified,Unqualified,Import,Definition}; 2162 + 2163 + #[derive(Copy, Clone)] 2164 + pub struct Owned(()); 2165 + impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } 2166 + impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } 2167 + impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } 2168 + impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } 2169 + 2170 + pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } 2171 + impl <> ::core::marker::Copy for Reader<'_,> {} 2172 + impl <> ::core::clone::Clone for Reader<'_,> { 2173 + fn clone(&self) -> Self { *self } 2174 + } 2175 + 2176 + impl <> ::capnp::traits::HasTypeId for Reader<'_,> { 2177 + const TYPE_ID: u64 = _private::TYPE_ID; 2178 + } 2179 + impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { 2180 + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { 2181 + Self { reader, } 2182 + } 2183 + } 2184 + 2185 + impl <'a,> ::core::convert::From<Reader<'a,>> for ::capnp::dynamic_value::Reader<'a> { 2186 + fn from(reader: Reader<'a,>) -> Self { 2187 + Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) 2188 + } 2189 + } 2190 + 2191 + impl <> ::core::fmt::Debug for Reader<'_,> { 2192 + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { 2193 + core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) 2194 + } 2195 + } 2196 + 2197 + impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { 2198 + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { 2199 + ::core::result::Result::Ok(reader.get_struct(default)?.into()) 2200 + } 2201 + } 2202 + 2203 + impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { 2204 + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { 2205 + self.reader 2206 + } 2207 + } 2208 + 2209 + impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { 2210 + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { 2211 + self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) 2212 + } 2213 + } 2214 + 2215 + impl <> Reader<'_,> { 2216 + pub fn reborrow(&self) -> Reader<'_,> { 2217 + Self { .. *self } 2218 + } 2219 + 2220 + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { 2221 + self.reader.total_size() 2222 + } 2223 + #[inline] 2224 + pub fn which(self) -> ::core::result::Result<WhichReader, ::capnp::NotInSchema> { 2225 + match self.reader.get_data_field::<u16>(0) { 2226 + 0 => { 2227 + ::core::result::Result::Ok(Qualified( 2228 + () 2229 + )) 2230 + } 2231 + 1 => { 2232 + ::core::result::Result::Ok(Unqualified( 2233 + () 2234 + )) 2235 + } 2236 + 2 => { 2237 + ::core::result::Result::Ok(Import( 2238 + () 2239 + )) 2240 + } 2241 + 3 => { 2242 + ::core::result::Result::Ok(Definition( 2243 + () 2244 + )) 2245 + } 2246 + x => ::core::result::Result::Err(::capnp::NotInSchema(x)) 2247 + } 2248 + } 2249 + } 2250 + 2251 + pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } 2252 + impl <> ::capnp::traits::HasStructSize for Builder<'_,> { 2253 + const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 0 }; 2254 + } 2255 + impl <> ::capnp::traits::HasTypeId for Builder<'_,> { 2256 + const TYPE_ID: u64 = _private::TYPE_ID; 2257 + } 2258 + impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { 2259 + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { 2260 + Self { builder, } 2261 + } 2262 + } 2263 + 2264 + impl <'a,> ::core::convert::From<Builder<'a,>> for ::capnp::dynamic_value::Builder<'a> { 2265 + fn from(builder: Builder<'a,>) -> Self { 2266 + Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) 2267 + } 2268 + } 2269 + 2270 + impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { 2271 + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { 2272 + self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) 2273 + } 2274 + } 2275 + 2276 + impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { 2277 + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { 2278 + builder.init_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE).into() 2279 + } 2280 + fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { 2281 + ::core::result::Result::Ok(builder.get_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE, default)?.into()) 2282 + } 2283 + } 2284 + 2285 + impl <> ::capnp::traits::SetterInput<Owned<>> for Reader<'_,> { 2286 + fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } 2287 + } 2288 + 2289 + impl <'a,> Builder<'a,> { 2290 + pub fn into_reader(self) -> Reader<'a,> { 2291 + self.builder.into_reader().into() 2292 + } 2293 + pub fn reborrow(&mut self) -> Builder<'_,> { 2294 + Builder { builder: self.builder.reborrow() } 2295 + } 2296 + pub fn reborrow_as_reader(&self) -> Reader<'_,> { 2297 + self.builder.as_reader().into() 2298 + } 2299 + 2300 + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { 2301 + self.builder.as_reader().total_size() 2302 + } 2303 + #[inline] 2304 + pub fn set_qualified(&mut self, _value: ()) { 2305 + self.builder.set_data_field::<u16>(0, 0); 2306 + } 2307 + #[inline] 2308 + pub fn set_unqualified(&mut self, _value: ()) { 2309 + self.builder.set_data_field::<u16>(0, 1); 2310 + } 2311 + #[inline] 2312 + pub fn set_import(&mut self, _value: ()) { 2313 + self.builder.set_data_field::<u16>(0, 2); 2314 + } 2315 + #[inline] 2316 + pub fn set_definition(&mut self, _value: ()) { 2317 + self.builder.set_data_field::<u16>(0, 3); 2318 + } 2319 + #[inline] 2320 + pub fn which(self) -> ::core::result::Result<WhichBuilder, ::capnp::NotInSchema> { 2321 + match self.builder.get_data_field::<u16>(0) { 2322 + 0 => { 2323 + ::core::result::Result::Ok(Qualified( 2324 + () 2325 + )) 2326 + } 2327 + 1 => { 2328 + ::core::result::Result::Ok(Unqualified( 2329 + () 2330 + )) 2331 + } 2332 + 2 => { 2333 + ::core::result::Result::Ok(Import( 2334 + () 2335 + )) 2336 + } 2337 + 3 => { 2338 + ::core::result::Result::Ok(Definition( 2339 + () 2340 + )) 2341 + } 2342 + x => ::core::result::Result::Err(::capnp::NotInSchema(x)) 2343 + } 2344 + } 2345 + } 2346 + 2347 + pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } 2348 + impl ::capnp::capability::FromTypelessPipeline for Pipeline { 2349 + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { 2350 + Self { _typeless: typeless, } 2351 + } 2352 + } 2353 + impl Pipeline { 2354 + } 2355 + mod _private { 2356 + pub static ENCODED_NODE: [::capnp::Word; 81] = [ 2357 + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), 2358 + ::capnp::word(201, 38, 14, 81, 37, 76, 28, 166), 2359 + ::capnp::word(13, 0, 0, 0, 1, 0, 1, 0), 2360 + ::capnp::word(190, 237, 188, 253, 156, 169, 51, 181), 2361 + ::capnp::word(0, 0, 7, 0, 0, 0, 4, 0), 2362 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2363 + ::capnp::word(21, 0, 0, 0, 218, 0, 0, 0), 2364 + ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), 2365 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2366 + ::capnp::word(29, 0, 0, 0, 231, 0, 0, 0), 2367 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2368 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2369 + ::capnp::word(115, 99, 104, 101, 109, 97, 46, 99), 2370 + ::capnp::word(97, 112, 110, 112, 58, 82, 101, 102), 2371 + ::capnp::word(101, 114, 101, 110, 99, 101, 75, 105), 2372 + ::capnp::word(110, 100, 0, 0, 0, 0, 0, 0), 2373 + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), 2374 + ::capnp::word(16, 0, 0, 0, 3, 0, 4, 0), 2375 + ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), 2376 + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), 2377 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2378 + ::capnp::word(97, 0, 0, 0, 82, 0, 0, 0), 2379 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2380 + ::capnp::word(96, 0, 0, 0, 3, 0, 1, 0), 2381 + ::capnp::word(108, 0, 0, 0, 2, 0, 1, 0), 2382 + ::capnp::word(1, 0, 254, 255, 0, 0, 0, 0), 2383 + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), 2384 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2385 + ::capnp::word(105, 0, 0, 0, 98, 0, 0, 0), 2386 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2387 + ::capnp::word(104, 0, 0, 0, 3, 0, 1, 0), 2388 + ::capnp::word(116, 0, 0, 0, 2, 0, 1, 0), 2389 + ::capnp::word(2, 0, 253, 255, 0, 0, 0, 0), 2390 + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), 2391 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2392 + ::capnp::word(113, 0, 0, 0, 58, 0, 0, 0), 2393 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2394 + ::capnp::word(108, 0, 0, 0, 3, 0, 1, 0), 2395 + ::capnp::word(120, 0, 0, 0, 2, 0, 1, 0), 2396 + ::capnp::word(3, 0, 252, 255, 0, 0, 0, 0), 2397 + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), 2398 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2399 + ::capnp::word(117, 0, 0, 0, 90, 0, 0, 0), 2400 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2401 + ::capnp::word(116, 0, 0, 0, 3, 0, 1, 0), 2402 + ::capnp::word(128, 0, 0, 0, 2, 0, 1, 0), 2403 + ::capnp::word(113, 117, 97, 108, 105, 102, 105, 101), 2404 + ::capnp::word(100, 0, 0, 0, 0, 0, 0, 0), 2405 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2406 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2407 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2408 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2409 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2410 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2411 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2412 + ::capnp::word(117, 110, 113, 117, 97, 108, 105, 102), 2413 + ::capnp::word(105, 101, 100, 0, 0, 0, 0, 0), 2414 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2415 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2416 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2417 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2418 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2419 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2420 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2421 + ::capnp::word(105, 109, 112, 111, 114, 116, 0, 0), 2422 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2423 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2424 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2425 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2426 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2427 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2428 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2429 + ::capnp::word(100, 101, 102, 105, 110, 105, 116, 105), 2430 + ::capnp::word(111, 110, 0, 0, 0, 0, 0, 0), 2431 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2432 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2433 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2434 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2435 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2436 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2437 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2438 + ]; 2439 + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { 2440 + match index { 2441 + 0 => <() as ::capnp::introspect::Introspect>::introspect(), 2442 + 1 => <() as ::capnp::introspect::Introspect>::introspect(), 2443 + 2 => <() as ::capnp::introspect::Introspect>::introspect(), 2444 + 3 => <() as ::capnp::introspect::Introspect>::introspect(), 2445 + _ => panic!("invalid field index {}", index), 2446 + } 2447 + } 2448 + pub fn get_annotation_types(child_index: Option<u16>, index: u32) -> ::capnp::introspect::Type { 2449 + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) 2450 + } 2451 + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { 2452 + encoded_node: &ENCODED_NODE, 2453 + nonunion_members: NONUNION_MEMBERS, 2454 + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, 2455 + members_by_name: MEMBERS_BY_NAME, 2456 + }; 2457 + pub static NONUNION_MEMBERS : &[u16] = &[]; 2458 + pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[0,1,2,3]; 2459 + pub static MEMBERS_BY_NAME : &[u16] = &[3,2,0,1]; 2460 + pub const TYPE_ID: u64 = 0xa61c_4c25_510e_26c9; 2461 + } 2462 + pub enum Which { 2463 + Qualified(()), 2464 + Unqualified(()), 2465 + Import(()), 2466 + Definition(()), 2467 + } 2468 + pub type WhichReader = Which; 2469 + pub type WhichBuilder = Which; 1905 2470 } 1906 2471 1907 2472 pub mod type_alias_constructor {
+15 -1
compiler-core/schema.capnp
··· 44 44 struct ValueReference { 45 45 module @0 :Text; 46 46 name @1 :Text; 47 - references @2 :List(SrcSpan); 47 + references @2 :List(Reference); 48 + } 49 + 50 + struct Reference { 51 + location @0 :SrcSpan; 52 + kind @1 :ReferenceKind; 53 + } 54 + 55 + struct ReferenceKind { 56 + union { 57 + qualified @0 :Void; 58 + unqualified @1 :Void; 59 + import @2 :Void; 60 + definition @3 :Void; 61 + } 48 62 } 49 63 50 64 struct TypeAliasConstructor {
+4
compiler-core/src/analyse.rs
··· 20 20 dep_tree, 21 21 line_numbers::LineNumbers, 22 22 parse::SpannedString, 23 + reference::ReferenceKind, 23 24 type_::{ 24 25 self, AccessorsMap, Deprecation, ModuleInterface, Opaque, PatternConstructor, 25 26 RecordAccessor, References, Type, TypeAliasConstructor, TypeConstructor, ··· 430 431 environment.current_module.clone(), 431 432 name.clone(), 432 433 name_location, 434 + ReferenceKind::Definition, 433 435 ); 434 436 435 437 if publicity.is_private() { ··· 653 655 environment.current_module.clone(), 654 656 name.clone(), 655 657 name_location, 658 + ReferenceKind::Definition, 656 659 ); 657 660 658 661 Definition::Function(Function { ··· 1108 1111 environment.current_module.clone(), 1109 1112 constructor.name.clone(), 1110 1113 constructor.name_location, 1114 + ReferenceKind::Definition, 1111 1115 ); 1112 1116 1113 1117 if value_constructor_publicity.is_private() {
+3
compiler-core/src/analyse/imports.rs
··· 3 3 use crate::{ 4 4 ast::{SrcSpan, UnqualifiedImport, UntypedImport}, 5 5 build::Origin, 6 + reference::ReferenceKind, 6 7 type_::{ 7 8 EntityKind, Environment, Error, ModuleInterface, Problems, UnusedModuleAlias, 8 9 ValueConstructorVariant, ··· 175 176 module.clone(), 176 177 import_name.clone(), 177 178 import.imported_name_location, 179 + ReferenceKind::Import, 178 180 ); 179 181 } 180 182 ValueConstructorVariant::ModuleConstant { module, .. } ··· 189 191 module.clone(), 190 192 import_name.clone(), 191 193 import.imported_name_location, 194 + ReferenceKind::Import, 192 195 ); 193 196 } 194 197 _ => self.environment.init_usage(
+1 -1
compiler-core/src/language_server/rename.rs
··· 131 131 132 132 references 133 133 .iter() 134 - .for_each(|location| edits.replace(*location, new_name.clone())); 134 + .for_each(|reference| edits.replace(reference.location, new_name.clone())); 135 135 136 136 let Some(uri) = url_from_path(source_information.path.as_str()) else { 137 137 return;
+20 -2
compiler-core/src/metadata/module_decoder.rs
··· 12 12 }, 13 13 build::Origin, 14 14 line_numbers::LineNumbers, 15 + reference::{Reference, ReferenceKind, ReferenceMap}, 15 16 schema_capnp::{self as schema, *}, 16 17 type_::{ 17 18 self, AccessorsMap, Deprecation, FieldMap, ModuleInterface, Opaque, RecordAccessor, ··· 127 128 fn value_references( 128 129 &self, 129 130 reader: capnp::struct_list::Reader<'_, value_reference::Owned>, 130 - ) -> Result<HashMap<(EcoString, EcoString), Vec<SrcSpan>>> { 131 + ) -> Result<ReferenceMap> { 131 132 let mut map = HashMap::with_capacity(reader.len() as usize); 132 133 for prop in reader.into_iter() { 133 134 let module = self.string(prop.get_module()?)?; 134 135 let name = self.string(prop.get_name()?)?; 135 - let references = read_vec!(prop.get_references()?, self, src_span); 136 + let references = read_vec!(prop.get_references()?, self, reference); 136 137 let _ = map.insert((module, name), references); 137 138 } 138 139 Ok(map) 140 + } 141 + 142 + fn reference(&self, reader: &reference::Reader<'_>) -> Result<Reference> { 143 + Ok(Reference { 144 + location: self.src_span(&reader.get_location()?)?, 145 + kind: self.reference_kind(&reader.get_kind()?)?, 146 + }) 147 + } 148 + 149 + fn reference_kind(&self, reader: &reference_kind::Reader<'_>) -> Result<ReferenceKind> { 150 + use reference_kind::Which; 151 + Ok(match reader.which()? { 152 + Which::Qualified(_) => ReferenceKind::Qualified, 153 + Which::Unqualified(_) => ReferenceKind::Unqualified, 154 + Which::Import(_) => ReferenceKind::Import, 155 + Which::Definition(_) => ReferenceKind::Definition, 156 + }) 139 157 } 140 158 141 159 fn type_constructor(
+13 -1
compiler-core/src/metadata/module_encoder.rs
··· 5 5 Constant, Publicity, SrcSpan, TypedConstant, TypedConstantBitArraySegment, 6 6 TypedConstantBitArraySegmentOption, 7 7 }, 8 + reference::{Reference, ReferenceKind}, 8 9 schema_capnp::{self as schema, *}, 9 10 type_::{ 10 11 self, AccessorsMap, Deprecation, FieldMap, Opaque, RecordAccessor, Type, ··· 219 220 builder.reborrow().init_references(references.len() as u32); 220 221 for (i, reference) in references.iter().enumerate() { 221 222 let builder = references_builder.reborrow().get(i as u32); 222 - self.build_src_span(builder, *reference); 223 + self.build_reference(builder, reference); 223 224 } 224 225 } 226 + } 227 + 228 + fn build_reference(&mut self, mut builder: reference::Builder<'_>, reference: &Reference) { 229 + let mut kind = builder.reborrow().init_kind(); 230 + match reference.kind { 231 + ReferenceKind::Qualified => kind.set_qualified(()), 232 + ReferenceKind::Unqualified => kind.set_unqualified(()), 233 + ReferenceKind::Import => kind.set_import(()), 234 + ReferenceKind::Definition => kind.set_definition(()), 235 + } 236 + self.build_src_span(builder.init_location(), reference.location); 225 237 } 226 238 227 239 fn set_version(&mut self, module: &mut module::Builder<'_>) {
+33 -5
compiler-core/src/metadata/tests.rs
··· 10 10 }, 11 11 build::Origin, 12 12 line_numbers::LineNumbers, 13 + reference::{Reference, ReferenceKind}, 13 14 type_::{ 14 15 self, Deprecation, ModuleInterface, Opaque, References, Type, TypeAliasConstructor, 15 16 TypeConstructor, TypeValueConstructor, TypeValueConstructorField, TypeVariantConstructors, ··· 1858 1859 value_references: [ 1859 1860 ( 1860 1861 ("some_module".into(), "some_function".into()), 1861 - vec![SrcSpan::new(1, 6), SrcSpan::new(7, 11)], 1862 + vec![ 1863 + Reference { 1864 + location: SrcSpan::new(1, 6), 1865 + kind: ReferenceKind::Definition, 1866 + }, 1867 + Reference { 1868 + location: SrcSpan::new(7, 11), 1869 + kind: ReferenceKind::Unqualified, 1870 + }, 1871 + ], 1862 1872 ), 1863 1873 ( 1864 1874 ("some_other_module".into(), "some_constant".into()), 1865 - vec![SrcSpan::new(6, 9), SrcSpan::new(90, 108)], 1875 + vec![ 1876 + Reference { 1877 + location: SrcSpan::new(6, 9), 1878 + kind: ReferenceKind::Import, 1879 + }, 1880 + Reference { 1881 + location: SrcSpan::new(90, 108), 1882 + kind: ReferenceKind::Unqualified, 1883 + }, 1884 + ], 1866 1885 ), 1867 1886 ( 1868 1887 ("some_other_module".into(), "SomeTypeVariant".into()), 1869 1888 vec![ 1870 - SrcSpan::new(26, 35), 1871 - SrcSpan::new(152, 204), 1872 - SrcSpan::new(0, 8), 1889 + Reference { 1890 + location: SrcSpan::new(26, 35), 1891 + kind: ReferenceKind::Qualified, 1892 + }, 1893 + Reference { 1894 + location: SrcSpan::new(152, 204), 1895 + kind: ReferenceKind::Qualified, 1896 + }, 1897 + Reference { 1898 + location: SrcSpan::new(0, 8), 1899 + kind: ReferenceKind::Qualified, 1900 + }, 1873 1901 ], 1874 1902 ), 1875 1903 ]
+26 -4
compiler-core/src/reference.rs
··· 7 7 stable_graph::{NodeIndex, StableGraph}, 8 8 }; 9 9 10 + #[derive(Debug, Clone, Copy, PartialEq, Eq)] 11 + pub enum ReferenceKind { 12 + Qualified, 13 + Unqualified, 14 + Import, 15 + Definition, 16 + } 17 + 18 + #[derive(Debug, Clone, Copy, PartialEq, Eq)] 19 + pub struct Reference { 20 + pub location: SrcSpan, 21 + pub kind: ReferenceKind, 22 + } 23 + 24 + pub type ReferenceMap = HashMap<(EcoString, EcoString), Vec<Reference>>; 25 + 10 26 #[derive(Debug, Default)] 11 27 pub struct ReferenceTracker { 12 28 /// A call-graph which tracks which values are referenced by which other value, ··· 17 33 18 34 /// The locations of the references to each value in this module, used for 19 35 /// renaming and go-to reference. 20 - reference_locations: HashMap<(EcoString, EcoString), Vec<SrcSpan>>, 36 + reference_locations: ReferenceMap, 21 37 } 22 38 23 39 impl ReferenceTracker { ··· 27 43 } 28 44 29 45 impl ReferenceTracker { 30 - pub fn into_locations(self) -> HashMap<(EcoString, EcoString), Vec<SrcSpan>> { 46 + pub fn into_locations(self) -> ReferenceMap { 31 47 self.reference_locations 32 48 } 33 49 ··· 47 63 self.current_function = self.get_or_create_node(module, name); 48 64 } 49 65 50 - pub fn register_reference(&mut self, module: EcoString, name: EcoString, location: SrcSpan) { 66 + pub fn register_reference( 67 + &mut self, 68 + module: EcoString, 69 + name: EcoString, 70 + location: SrcSpan, 71 + kind: ReferenceKind, 72 + ) { 51 73 let target = self.get_or_create_node(module.clone(), name.clone()); 52 74 self.reference_locations 53 75 .entry((module, name)) 54 76 .or_default() 55 - .push(location); 77 + .push(Reference { location, kind }); 56 78 57 79 _ = self.graph.add_edge(self.current_function, target, ()); 58 80 }
+2 -1
compiler-core/src/type_.rs
··· 31 31 bit_array, 32 32 build::{Origin, Target}, 33 33 line_numbers::LineNumbers, 34 + reference::ReferenceMap, 34 35 type_::expression::Implementations, 35 36 }; 36 37 use error::*; ··· 903 904 #[derive(Debug, Clone, PartialEq, Eq, Default)] 904 905 pub struct References { 905 906 pub imported_modules: HashSet<EcoString>, 906 - pub value_references: HashMap<(EcoString, EcoString), Vec<SrcSpan>>, 907 + pub value_references: ReferenceMap, 907 908 } 908 909 909 910 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
+16 -2
compiler-core/src/type_/expression.rs
··· 13 13 }, 14 14 build::Target, 15 15 exhaustiveness::{self, Reachability}, 16 + reference::ReferenceKind, 16 17 }; 17 18 use hexpm::version::Version; 18 19 use id_arena::Arena; ··· 1078 1079 name, 1079 1080 &constructor.variant, 1080 1081 *location, 1082 + ReferenceKind::Unqualified, 1081 1083 ) 1082 1084 } 1083 1085 } ··· 1106 1108 module_name.clone(), 1107 1109 label.clone(), 1108 1110 SrcSpan::new(field_start, location.end), 1111 + ReferenceKind::Qualified, 1109 1112 ); 1110 1113 TypedExpr::ModuleSelect { 1111 1114 location, ··· 2335 2338 module_name.clone(), 2336 2339 label.clone(), 2337 2340 location, 2341 + ReferenceKind::Qualified, 2338 2342 ); 2339 2343 2340 2344 Ok(ClauseGuard::ModuleSelect { ··· 3009 3013 register_reference, 3010 3014 ReferenceRegistration::RegisterReferences 3011 3015 ) { 3012 - self.register_value_constructor_reference(name, &variant, *location); 3016 + self.register_value_constructor_reference( 3017 + name, 3018 + &variant, 3019 + *location, 3020 + if module.is_some() { 3021 + ReferenceKind::Qualified 3022 + } else { 3023 + ReferenceKind::Unqualified 3024 + }, 3025 + ); 3013 3026 } 3014 3027 3015 3028 // Instantiate generic variables into unbound variables for this usage ··· 3027 3040 referenced_name: &EcoString, 3028 3041 variant: &ValueConstructorVariant, 3029 3042 location: SrcSpan, 3043 + kind: ReferenceKind, 3030 3044 ) { 3031 3045 match variant { 3032 3046 // If the referenced name is different to the name of the original ··· 3046 3060 | ValueConstructorVariant::ModuleConstant { name, module, .. } => self 3047 3061 .environment 3048 3062 .references 3049 - .register_reference(module.clone(), name.clone(), location), 3063 + .register_reference(module.clone(), name.clone(), location, kind), 3050 3064 ValueConstructorVariant::LocalVariable { .. } 3051 3065 | ValueConstructorVariant::LocalConstant { .. } => {} 3052 3066 }
+6
compiler-core/src/type_/pattern.rs
··· 12 12 ast::{ 13 13 AssignName, BitArrayOption, ImplicitCallArgOrigin, Layer, UntypedPatternBitArraySegment, 14 14 }, 15 + reference::ReferenceKind, 15 16 type_::expression::FunctionDefinition, 16 17 }; 17 18 use std::sync::Arc; ··· 821 822 constructor.module.clone(), 822 823 constructor.name.clone(), 823 824 name_location, 825 + if module.is_some() { 826 + ReferenceKind::Qualified 827 + } else { 828 + ReferenceKind::Unqualified 829 + }, 824 830 ); 825 831 826 832 let instantiated_constructor_type =