Skip to content

WIP: remove compiler plugin API for syntax transformers #64665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions src/librustc_plugin/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use rustc::lint::{EarlyLintPassObject, LateLintPassObject, LintId, Lint};
use rustc::session::Session;
use rustc::util::nodemap::FxHashMap;

use syntax::ext::base::{SyntaxExtension, SyntaxExtensionKind, NamedSyntaxExtension};
use syntax::ext::base::MacroExpanderFn;
use syntax::ext::base::NamedSyntaxExtension;
use syntax::symbol::Symbol;
use syntax::ast;
use syntax::feature_gate::AttributeType;
Expand Down Expand Up @@ -81,24 +80,6 @@ impl<'a> Registry<'a> {
self.args_hidden.as_ref().map(|v| &v[..]).unwrap_or(&[])
}

/// Register a syntax extension of any kind.
///
/// This is the most general hook into `libsyntax`'s expansion behavior.
pub fn register_syntax_extension(&mut self, name: ast::Name, extension: SyntaxExtension) {
self.syntax_exts.push((name, extension));
}

/// Register a macro of the usual kind.
///
/// This is a convenience wrapper for `register_syntax_extension`.
/// It builds for you a `SyntaxExtensionKind::LegacyBang` that calls `expander`,
/// and also takes care of interning the macro's name.
pub fn register_macro(&mut self, name: &str, expander: MacroExpanderFn) {
let kind = SyntaxExtensionKind::LegacyBang(Box::new(expander));
let ext = SyntaxExtension::default(kind, self.sess.edition());
self.register_syntax_extension(Symbol::intern(name), ext);
}

/// Register a compiler lint pass.
pub fn register_early_lint_pass(&mut self, lint_pass: EarlyLintPassObject) {
self.early_lint_passes.push(lint_pass);
Expand Down