Skip to content

Commit e0ee2db

Browse files
committed
---
yaml --- r: 153108 b: refs/heads/try2 c: f126eac h: refs/heads/master v: v3
1 parent 753277f commit e0ee2db

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 4358bf8bfa1bfc853b51c29d48a2d57eb8dfee0a
8+
refs/heads/try2: f126eacd115415b0814ceb4a1c71380a0b2eb752
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/ast.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,10 @@ pub enum Expr_ {
453453
ExprCast(Gc<Expr>, P<Ty>),
454454
ExprIf(Gc<Expr>, P<Block>, Option<Gc<Expr>>),
455455
ExprWhile(Gc<Expr>, P<Block>),
456-
// FIXME #6993: change to Option<Name>
456+
// FIXME #6993: change to Option<Name> ... or not, if these are hygienic.
457457
ExprForLoop(Gc<Pat>, Gc<Expr>, P<Block>, Option<Ident>),
458458
// Conditionless loop (can be exited with break, cont, or ret)
459-
// FIXME #6993: change to Option<Name>
459+
// FIXME #6993: change to Option<Name> ... or not, if these are hygienic.
460460
ExprLoop(P<Block>, Option<Ident>),
461461
ExprMatch(Gc<Expr>, Vec<Arm>),
462462
ExprFnBlock(P<FnDecl>, P<Block>),
@@ -468,9 +468,8 @@ pub enum Expr_ {
468468
ExprField(Gc<Expr>, SpannedIdent, Vec<P<Ty>>),
469469
ExprIndex(Gc<Expr>, Gc<Expr>),
470470

471-
/// Expression that looks like a "name". For example,
472-
/// `std::slice::from_elem::<uint>` is an ExprPath that's the "name" part
473-
/// of a function call.
471+
/// Variable reference, possibly containing `::` and/or
472+
/// type parameters, e.g. foo::bar::<baz>
474473
ExprPath(Path),
475474

476475
ExprAddrOf(Mutability, Gc<Expr>),
@@ -643,6 +642,8 @@ pub struct TypeField {
643642
pub span: Span,
644643
}
645644

645+
/// Represents a required method in a trait declaration,
646+
/// one without a default implementation
646647
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
647648
pub struct TypeMethod {
648649
pub ident: Ident,
@@ -656,6 +657,8 @@ pub struct TypeMethod {
656657
pub vis: Visibility,
657658
}
658659

660+
/// Represents a method declaration in a trait declaration, possibly
661+
/// including a default implementation
659662
// A trait method is either required (meaning it doesn't have an
660663
// implementation, just a signature) or provided (meaning it has a default
661664
// implementation).
@@ -741,6 +744,7 @@ impl fmt::Show for Onceness {
741744
}
742745
}
743746

747+
/// Represents the type of a closure
744748
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
745749
pub struct ClosureTy {
746750
pub lifetimes: Vec<Lifetime>,
@@ -809,6 +813,7 @@ pub struct InlineAsm {
809813
pub dialect: AsmDialect
810814
}
811815

816+
/// represents an argument in a function header
812817
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
813818
pub struct Arg {
814819
pub ty: P<Ty>,
@@ -836,7 +841,7 @@ impl Arg {
836841
}
837842
}
838843

839-
// represents the header (not the body) of a function declaration
844+
/// represents the header (not the body) of a function declaration
840845
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
841846
pub struct FnDecl {
842847
pub inputs: Vec<Arg>,
@@ -1107,6 +1112,7 @@ pub enum Item_ {
11071112
ItemTy(P<Ty>, Generics),
11081113
ItemEnum(EnumDef, Generics),
11091114
ItemStruct(Gc<StructDef>, Generics),
1115+
/// Represents a Trait Declaration
11101116
ItemTrait(Generics, Sized, Vec<TraitRef> , Vec<TraitMethod> ),
11111117
ItemImpl(Generics,
11121118
Option<TraitRef>, // (optional) trait this impl implements

branches/try2/src/libsyntax/ext/expand.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ fn expand_loop_block(loop_block: P<Block>,
267267
}
268268
}
269269

270-
// eval $e with a new exts frame:
270+
// eval $e with a new exts frame.
271+
// must be a macro so that $e isn't evaluated too early.
271272
macro_rules! with_exts_frame (
272273
($extsboxexpr:expr,$macros_escape:expr,$e:expr) =>
273274
({$extsboxexpr.push_frame();
@@ -609,7 +610,7 @@ fn expand_non_macro_stmt(s: &Stmt, fld: &mut MacroExpander)
609610
} = **local;
610611
// expand the pat (it might contain macro uses):
611612
let expanded_pat = fld.fold_pat(pat);
612-
// find the pat_idents in the pattern:
613+
// find the PatIdents in the pattern:
613614
// oh dear heaven... this is going to include the enum
614615
// names, as well... but that should be okay, as long as
615616
// the new names are gensyms for the old ones.
@@ -691,39 +692,34 @@ fn expand_arm(arm: &ast::Arm, fld: &mut MacroExpander) -> ast::Arm {
691692

692693

693694

694-
// a visitor that extracts the pat_ident (binding) paths
695-
// from a given thingy and puts them in a mutable
696-
// array
695+
/// A visitor that extracts the PatIdent (binding) paths
696+
/// from a given thingy and puts them in a mutable
697+
/// array
697698
#[deriving(Clone)]
698-
struct NameFinderContext {
699+
struct PatIdentFinder {
699700
ident_accumulator: Vec<ast::Ident> ,
700701
}
701702

702-
impl Visitor<()> for NameFinderContext {
703+
impl Visitor<()> for PatIdentFinder {
703704
fn visit_pat(&mut self, pattern: &ast::Pat, _: ()) {
704705
match *pattern {
705-
// we found a pat_ident!
706-
ast::Pat {
707-
id: _,
708-
node: ast::PatIdent(_, ref path1, ref inner),
709-
span: _
710-
} => {
706+
ast::Pat { id: _, node: ast::PatIdent(_, ref path1, ref inner), span: _ } => {
711707
self.ident_accumulator.push(path1.node);
712-
// visit optional subpattern of pat_ident:
708+
// visit optional subpattern of PatIdent:
713709
for subpat in inner.iter() {
714710
self.visit_pat(&**subpat, ())
715711
}
716712
}
717-
// use the default traversal for non-pat_idents
713+
// use the default traversal for non-PatIdents
718714
_ => visit::walk_pat(self, pattern, ())
719715
}
720716
}
721717

722718
}
723719

724-
// find the pat_ident paths in a pattern
720+
/// find the PatIdent paths in a pattern
725721
fn pattern_bindings(pat : &ast::Pat) -> Vec<ast::Ident> {
726-
let mut name_finder = NameFinderContext{ident_accumulator:Vec::new()};
722+
let mut name_finder = PatIdentFinder{ident_accumulator:Vec::new()};
727723
name_finder.visit_pat(pat,());
728724
name_finder.ident_accumulator
729725
}
@@ -1028,7 +1024,7 @@ fn original_span(cx: &ExtCtxt) -> Gc<codemap::ExpnInfo> {
10281024
#[cfg(test)]
10291025
mod test {
10301026
use super::{pattern_bindings, expand_crate, contains_macro_escape};
1031-
use super::{NameFinderContext};
1027+
use super::{PatIdentFinder};
10321028
use ast;
10331029
use ast::{Attribute_, AttrOuter, MetaWord};
10341030
use attr;
@@ -1167,7 +1163,7 @@ mod test {
11671163

11681164
// find the pat_ident paths in a crate
11691165
fn crate_bindings(the_crate : &ast::Crate) -> Vec<ast::Ident> {
1170-
let mut name_finder = NameFinderContext{ident_accumulator:Vec::new()};
1166+
let mut name_finder = PatIdentFinder{ident_accumulator:Vec::new()};
11711167
visit::walk_crate(&mut name_finder, the_crate, ());
11721168
name_finder.ident_accumulator
11731169
}

0 commit comments

Comments
 (0)