mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
fixup! Move PropertyBitField to a syntax extension.
This commit is contained in:
parent
d6002a0a50
commit
653f257029
1 changed files with 5 additions and 1 deletions
|
@ -15,7 +15,7 @@ extern crate sync;
|
||||||
|
|
||||||
extern crate rustc;
|
extern crate rustc;
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
use syntax::ext::base;
|
use syntax::ext::base;
|
||||||
|
@ -92,10 +92,12 @@ fn expand_bit_struct(cx: &mut ExtCtxt, sp: Span, name: ast::Ident, tts: Vec<ast:
|
||||||
let additional_impl = quote_item!(&*cx,
|
let additional_impl = quote_item!(&*cx,
|
||||||
impl $name {
|
impl $name {
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case_functions)]
|
||||||
|
#[inline]
|
||||||
pub fn $field(&self) -> bool {
|
pub fn $field(&self) -> bool {
|
||||||
(self.storage[$word] & (1 << $bit)) != 0
|
(self.storage[$word] & (1 << $bit)) != 0
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case_functions)]
|
#[allow(non_snake_case_functions)]
|
||||||
|
#[inline]
|
||||||
pub fn $setter(&mut self, new_value: bool) {
|
pub fn $setter(&mut self, new_value: bool) {
|
||||||
if new_value {
|
if new_value {
|
||||||
self.storage[$word] |= 1 << $bit
|
self.storage[$word] |= 1 << $bit
|
||||||
|
@ -118,6 +120,8 @@ fn expand_bit_struct(cx: &mut ExtCtxt, sp: Span, name: ast::Ident, tts: Vec<ast:
|
||||||
// Re-wrap.
|
// Re-wrap.
|
||||||
let impl_def = box(GC) impl_def;
|
let impl_def = box(GC) impl_def;
|
||||||
|
|
||||||
|
// FIXME(SimonSapin) replace this with something from libsyntax
|
||||||
|
// if/when https://github.com/rust-lang/rust/issues/16723 is fixed
|
||||||
struct MacItems {
|
struct MacItems {
|
||||||
items: Vec<Gc<ast::Item>>
|
items: Vec<Gc<ast::Item>>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue