File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ struct LanguageItemVisitor<'a> {
114
114
115
115
impl <' a> Visitor <( ) > for LanguageItemVisitor <' a> {
116
116
fn visit_item( & mut self , item: & ast:: Item , _: ( ) ) {
117
- match extract( item. attrs) {
117
+ match extract( self . this . session , item. attrs) {
118
118
Some ( value) => {
119
119
let item_index = self . this. item_refs. find_equiv( & value) . map( |x| * x) ;
120
120
@@ -183,14 +183,26 @@ impl LanguageItemCollector {
183
183
}
184
184
}
185
185
186
- pub fn extract( attrs: & [ ast:: Attribute ] ) -> Option <InternedString > {
186
+ pub fn extract( _ : Session , attrs: & [ ast:: Attribute ] ) -> Option <InternedString > {
187
187
for attribute in attrs. iter( ) {
188
188
match attribute. name_str_pair( ) {
189
189
Some ( ( ref key, ref value) ) if key. equiv( & ( "lang" ) ) => {
190
+ // Raise error after snapshot landed
191
+ //session.err(format!("`lang = {}` was replaced by `lang({})`",
192
+ // *value, *value));
190
193
return Some ( ( * value) . clone( ) ) ;
191
194
}
192
195
Some ( ..) | None => { }
193
196
}
197
+
198
+ if attribute. name( ) . equiv( & ( "lang" ) ) {
199
+ match attribute. meta_item_list( ) {
200
+ Some ( ref l) if l. len( ) == 1 => {
201
+ return Some ( l[ 0 ] . name( ) . clone( ) ) ;
202
+ }
203
+ _ => { }
204
+ }
205
+ }
194
206
}
195
207
196
208
return None ;
You can’t perform that action at this time.
0 commit comments