mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 13:18:54 +01:00
'#simplext' -> '#macro'
This commit is contained in:
parent
c3901cdf8e
commit
b3443eb049
@ -22,7 +22,7 @@ fn syntax_expander_table() -> hashmap[str, syntax_extension] {
|
||||
auto syntax_expanders = new_str_hash[syntax_extension]();
|
||||
syntax_expanders.insert("fmt", normal(extfmt::expand_syntax_ext));
|
||||
syntax_expanders.insert("env", normal(extenv::expand_syntax_ext));
|
||||
syntax_expanders.insert("simplext",
|
||||
syntax_expanders.insert("macro",
|
||||
macro_defining(extsimplext::add_new_extension));
|
||||
ret syntax_expanders;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//error-pattern:expanded as an identifier
|
||||
fn main() {
|
||||
#simplext("mylambda", x, body, {fn f(int x) -> int {ret body}; f});
|
||||
#macro("mylambda", x, body, {fn f(int x) -> int {ret body}; f});
|
||||
|
||||
assert(#mylambda(y*1, y*2)(8) == 16);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
//error-pattern:expects 0 arguments, got 16
|
||||
|
||||
fn main() {
|
||||
#simplext("trivial", 1*2*4*2*1);
|
||||
#macro("trivial", 1*2*4*2*1);
|
||||
|
||||
assert(#trivial(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) == 16);
|
||||
}
|
5
src/test/run-pass/macro-2.rs
Normal file
5
src/test/run-pass/macro-2.rs
Normal file
@ -0,0 +1,5 @@
|
||||
fn main() {
|
||||
#macro("mylambda", x, body, {fn f(int x) -> int {ret body}; f});
|
||||
|
||||
assert(#mylambda(y,y*2)(8) == 16);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fn main() {
|
||||
#simplext("trivial", 1*2*4*2*1);
|
||||
#macro("trivial", 1*2*4*2*1);
|
||||
|
||||
assert(#trivial() == 16);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
fn main() {
|
||||
#simplext("m1", a, a*4);
|
||||
#macro("m1", a, a*4);
|
||||
assert (#m1(2) == 8);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
fn main() {
|
||||
#simplext("mylambda", x, body, {fn f(int x) -> int {ret body}; f});
|
||||
|
||||
assert(#mylambda(y,y*2)(8) == 16);
|
||||
}
|
Loading…
Reference in New Issue
Block a user