@@ -15,8 +15,8 @@ pub struct ImportStatement<'a> {
1515 pub docs : Vec < DocComment < ' a > > ,
1616 /// The identifier of the imported item.
1717 pub id : Ident < ' a > ,
18- /// The optional `with` string .
19- pub with : Option < super :: String < ' a > > ,
18+ /// The optional import name .
19+ pub name : Option < super :: String < ' a > > ,
2020 /// The type of the imported item.
2121 pub ty : ImportType < ' a > ,
2222}
@@ -26,11 +26,11 @@ impl<'a> Parse<'a> for ImportStatement<'a> {
2626 let docs = Parse :: parse ( lexer) ?;
2727 parse_token ( lexer, Token :: ImportKeyword ) ?;
2828 let id = Parse :: parse ( lexer) ?;
29- let with = parse_optional ( lexer, Token :: WithKeyword , Parse :: parse) ?;
29+ let name = parse_optional ( lexer, Token :: AsKeyword , Parse :: parse) ?;
3030 parse_token ( lexer, Token :: Colon ) ?;
3131 let ty = Parse :: parse ( lexer) ?;
3232 parse_token ( lexer, Token :: Semicolon ) ?;
33- Ok ( Self { docs, id, with , ty } )
33+ Ok ( Self { docs, id, name , ty } )
3434 }
3535}
3636
@@ -195,8 +195,8 @@ mod test {
195195 . unwrap ( ) ;
196196
197197 roundtrip (
198- "package foo:bar; import x with \" y\" : foo:bar:baz/qux/jam@1.2.3-preview+abc;" ,
199- "package foo:bar;\n \n import x with \" y\" : foo:bar:baz/qux/jam@1.2.3-preview+abc;\n " ,
198+ "package foo:bar; import x as \" y\" : foo:bar:baz/qux/jam@1.2.3-preview+abc;" ,
199+ "package foo:bar;\n \n import x as \" y\" : foo:bar:baz/qux/jam@1.2.3-preview+abc;\n " ,
200200 )
201201 . unwrap ( ) ;
202202 }
@@ -210,8 +210,8 @@ mod test {
210210 . unwrap ( ) ;
211211
212212 roundtrip (
213- "package foo:bar; import x with \" foo\" : func(x: string) -> string;" ,
214- "package foo:bar;\n \n import x with \" foo\" : func(x: string) -> string;\n " ,
213+ "package foo:bar; import x as \" foo\" : func(x: string) -> string;" ,
214+ "package foo:bar;\n \n import x as \" foo\" : func(x: string) -> string;\n " ,
215215 )
216216 . unwrap ( ) ;
217217 }
@@ -225,8 +225,8 @@ mod test {
225225 . unwrap ( ) ;
226226
227227 roundtrip (
228- "package foo:bar; import x with \" foo\" : interface { x: func(x: string) -> string; };" ,
229- "package foo:bar;\n \n import x with \" foo\" : interface {\n x: func(x: string) -> string;\n };\n " ,
228+ "package foo:bar; import x as \" foo\" : interface { x: func(x: string) -> string; };" ,
229+ "package foo:bar;\n \n import x as \" foo\" : interface {\n x: func(x: string) -> string;\n };\n " ,
230230 )
231231 . unwrap ( ) ;
232232 }
@@ -240,8 +240,8 @@ mod test {
240240 . unwrap ( ) ;
241241
242242 roundtrip (
243- "package foo:bar; import x /*foo */ with \" foo\" : y;" ,
244- "package foo:bar;\n \n import x with \" foo\" : y;\n " ,
243+ "package foo:bar; import x /*foo */ as \" foo\" : y;" ,
244+ "package foo:bar;\n \n import x as \" foo\" : y;\n " ,
245245 )
246246 . unwrap ( ) ;
247247 }
0 commit comments