Skip to content

Commit 0387765

Browse files
committed
---
yaml --- r: 90010 b: refs/heads/master c: 9a4c8da h: refs/heads/master v: v3
1 parent d4c0c76 commit 0387765

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b3ff24adaa8c7f9c48c525f284526c23ffd33fcb
2+
refs/heads/master: 9a4c8da5015d8f08310dd2123959761fea84d0f6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/librustc/middle/pat_util.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @Pat) -> bool {
7070
}
7171
}
7272

73+
/// Call `it` on every "binding" in a pattern, e.g., on `a` in
74+
/// `match foo() { Some(a) => (), None => () }`
7375
pub fn pat_bindings(dm: resolve::DefMap,
7476
pat: @Pat,
7577
it: |BindingMode, NodeId, Span, &Path|) {

trunk/src/librustc/middle/ty.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ pub enum AutoRef {
259259

260260
pub type ctxt = @ctxt_;
261261

262+
/// The data structure to keep track of all the information that typechecker
263+
/// generates so that so that it can be reused and doesn't have to be redone
264+
/// later on.
262265
struct ctxt_ {
263266
diag: @mut syntax::diagnostic::span_handler,
264267
interner: @mut HashMap<intern_key, ~t_box_>,
@@ -296,6 +299,8 @@ struct ctxt_ {
296299
trait_refs: @mut HashMap<NodeId, @TraitRef>,
297300
trait_defs: @mut HashMap<DefId, @TraitDef>,
298301

302+
/// Despite its name, `items` does not only map NodeId to an item but
303+
/// also to expr/stmt/local/arg/etc
299304
items: ast_map::map,
300305
intrinsic_defs: @mut HashMap<ast::DefId, t>,
301306
freevars: freevars::freevar_map,

trunk/src/libsyntax/ast.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ pub struct DefId {
173173
node: NodeId,
174174
}
175175

176+
/// Item definitions in the currently-compiled crate would have the CrateNum
177+
/// LOCAL_CRATE in their DefId.
176178
pub static LOCAL_CRATE: CrateNum = 0;
177179
pub static CRATE_NODE_ID: NodeId = 0;
178180

@@ -244,6 +246,10 @@ pub enum Def {
244246
@Def, // closed over def
245247
NodeId, // expr node that creates the closure
246248
NodeId), // id for the block/body of the closure expr
249+
250+
/// Note that if it's a tuple struct's definition, the node id
251+
/// of the DefId refers to the struct_def.ctor_id (whereas normally it
252+
/// refers to the item definition's id).
247253
DefStruct(DefId),
248254
DefTyParamBinder(NodeId), /* struct, impl or trait with ty params */
249255
DefRegion(NodeId),
@@ -451,6 +457,7 @@ pub enum Stmt_ {
451457

452458
// FIXME (pending discussion of #1697, #2178...): local should really be
453459
// a refinement on pat.
460+
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
454461
#[deriving(Eq, Encodable, Decodable,IterBytes)]
455462
pub struct Local {
456463
ty: Ty,
@@ -553,6 +560,10 @@ pub enum Expr_ {
553560
ExprAssignOp(NodeId, BinOp, @Expr, @Expr),
554561
ExprField(@Expr, Ident, ~[Ty]),
555562
ExprIndex(NodeId, @Expr, @Expr),
563+
564+
/// Expression that looks like a "name". For example,
565+
/// `std::vec::from_elem::<uint>` is an ExprPath that's the "name" part
566+
/// of a function call.
556567
ExprPath(Path),
557568

558569
/// The special identifier `self`.

trunk/src/libsyntax/ast_map.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,18 @@ pub enum ast_node {
111111
node_trait_method(@trait_method, DefId /* trait did */,
112112
@path /* path to the trait */),
113113
node_method(@method, DefId /* impl did */, @path /* path to the impl */),
114+
115+
/// node_variant represents a variant of an enum, e.g., for
116+
/// `enum A { B, C, D }`, there would be a node_item for `A`, and a
117+
/// node_variant item for each of `B`, `C`, and `D`.
114118
node_variant(variant, @item, @path),
115119
node_expr(@Expr),
116120
node_stmt(@Stmt),
117121
node_arg(@Pat),
118122
node_local(Ident),
119123
node_block(Block),
124+
125+
/// node_struct_ctor represents a tuple struct.
120126
node_struct_ctor(@struct_def, @item, @path),
121127
node_callee_scope(@Expr)
122128
}

0 commit comments

Comments
 (0)