Skip to content

Commit

Permalink
Replace ExpnId with SyntaxContext
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhota committed Apr 6, 2017
1 parent 10cbcd3 commit 57bd395
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ impl<'a> LoweringContext<'a> {
fn lower_global_asm(&mut self, ga: &GlobalAsm) -> P<hir::GlobalAsm> {
P(hir::GlobalAsm {
asm: ga.asm,
expn_id: ga.expn_id,
ctxt: ga.ctxt,
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ pub struct ForeignMod {
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct GlobalAsm {
pub asm: Symbol,
pub expn_id: ExpnId
pub ctxt: SyntaxContext
}

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ pub struct ForeignMod {
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub struct GlobalAsm {
pub asm: Symbol,
pub expn_id: ExpnId,
pub ctxt: SyntaxContext,
}

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
Expand Down
16 changes: 3 additions & 13 deletions src/libsyntax_ext/global_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use syntax::ast;
use syntax::ext::base;
use syntax::ext::base::*;
use syntax::codemap;
use syntax::feature_gate;
use syntax::ptr::P;
use syntax::symbol::Symbol;
Expand All @@ -46,28 +45,19 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,

let mut p = cx.new_parser_from_tts(tts);
let (asm, _) = match expr_to_string(cx,
panictry!(p.parse_expr()),
"inline assembly must be a string literal") {
panictry!(p.parse_expr()),
"inline assembly must be a string literal") {
Some((s, st)) => (s, st),
None => return DummyResult::any(sp),
};

let expn_id = cx.codemap().record_expansion(codemap::ExpnInfo {
call_site: sp,
callee: codemap::NameAndSpan {
format: codemap::MacroBang(Symbol::intern(MACRO)),
allow_internal_unstable: false,
span: None,
},
});

MacEager::items(SmallVector::one(P(ast::Item {
ident: ast::Ident::with_empty_ctxt(Symbol::intern("")),
attrs: Vec::new(),
id: ast::DUMMY_NODE_ID,
node: ast::ItemKind::GlobalAsm(P(ast::GlobalAsm {
asm: asm,
expn_id: expn_id,
ctxt: cx.backtrace(),
})),
vis: ast::Visibility::Inherited,
span: sp,
Expand Down

0 comments on commit 57bd395

Please sign in to comment.