Annotate FIXMEs in syntax::ast and syntax::ast_util
The main non-comment change was to change simple_path to path, as per a FIXME in ast.
This commit is contained in:
parent
16eb06c246
commit
1adc26d5e7
|
@ -18,8 +18,8 @@ import std::serialization::{serializer,
|
||||||
serialize_bool,
|
serialize_bool,
|
||||||
deserialize_bool};
|
deserialize_bool};
|
||||||
|
|
||||||
|
/* Note #1972 -- spans are serialized but not deserialized */
|
||||||
fn serialize_span<S>(_s: S, _v: span) {
|
fn serialize_span<S>(_s: S, _v: span) {
|
||||||
// FIXME-- serialize some span info
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deserialize_span<D>(_d: D) -> span {
|
fn deserialize_span<D>(_d: D) -> span {
|
||||||
|
@ -171,7 +171,10 @@ enum proto {
|
||||||
|
|
||||||
#[auto_serialize]
|
#[auto_serialize]
|
||||||
enum vstore {
|
enum vstore {
|
||||||
vstore_fixed(option<uint>), // [1,2,3,4]/_ or 4 FIXME: uint -> @expr
|
/* FIXME: Change uint to @expr (actually only constant exprs,
|
||||||
|
as per #2112)
|
||||||
|
*/
|
||||||
|
vstore_fixed(option<uint>), // [1,2,3,4]/_ or 4
|
||||||
vstore_uniq, // [1,2,3,4]/~
|
vstore_uniq, // [1,2,3,4]/~
|
||||||
vstore_box, // [1,2,3,4]/@
|
vstore_box, // [1,2,3,4]/@
|
||||||
vstore_slice(region) // [1,2,3,4]/&(foo)?
|
vstore_slice(region) // [1,2,3,4]/&(foo)?
|
||||||
|
@ -250,7 +253,9 @@ enum init_op { init_assign, init_move, }
|
||||||
type initializer = {op: init_op, expr: @expr};
|
type initializer = {op: init_op, expr: @expr};
|
||||||
|
|
||||||
#[auto_serialize]
|
#[auto_serialize]
|
||||||
type local_ = // FIXME: should really be a refinement on pat
|
type local_ = /* FIXME: should really be a refinement on pat
|
||||||
|
(pending discussion of #1697, #2178...)
|
||||||
|
*/
|
||||||
{is_mutbl: bool, ty: @ty, pat: @pat,
|
{is_mutbl: bool, ty: @ty, pat: @pat,
|
||||||
init: option<initializer>, id: node_id};
|
init: option<initializer>, id: node_id};
|
||||||
|
|
||||||
|
@ -289,7 +294,7 @@ enum expr_ {
|
||||||
expr_vstore(@expr, vstore),
|
expr_vstore(@expr, vstore),
|
||||||
expr_vec([@expr], mutability),
|
expr_vec([@expr], mutability),
|
||||||
expr_rec([field], option<@expr>),
|
expr_rec([field], option<@expr>),
|
||||||
expr_call(@expr, [@expr], bool),
|
expr_call(@expr, [@expr], bool), // True iff last argument is a block
|
||||||
expr_tup([@expr]),
|
expr_tup([@expr]),
|
||||||
expr_bind(@expr, [option<@expr>]),
|
expr_bind(@expr, [option<@expr>]),
|
||||||
expr_binary(binop, @expr, @expr),
|
expr_binary(binop, @expr, @expr),
|
||||||
|
@ -315,6 +320,7 @@ enum expr_ {
|
||||||
/*
|
/*
|
||||||
* FIXME: many of these @exprs should be constrained with
|
* FIXME: many of these @exprs should be constrained with
|
||||||
* is_lval once we have constrained types working.
|
* is_lval once we have constrained types working.
|
||||||
|
* (See #34)
|
||||||
*/
|
*/
|
||||||
expr_copy(@expr),
|
expr_copy(@expr),
|
||||||
expr_move(@expr, @expr),
|
expr_move(@expr, @expr),
|
||||||
|
@ -341,9 +347,6 @@ enum expr_ {
|
||||||
|
|
||||||
/* preds that typestate is aware of */
|
/* preds that typestate is aware of */
|
||||||
expr_check(expr_check_mode, @expr),
|
expr_check(expr_check_mode, @expr),
|
||||||
|
|
||||||
/* FIXME Would be nice if expr_check desugared
|
|
||||||
to expr_if_check. */
|
|
||||||
expr_if_check(@expr, blk, option<@expr>),
|
expr_if_check(@expr, blk, option<@expr>),
|
||||||
expr_mac(mac),
|
expr_mac(mac),
|
||||||
}
|
}
|
||||||
|
@ -587,11 +590,6 @@ type variant_ = {name: ident, attrs: [attribute], args: [variant_arg],
|
||||||
#[auto_serialize]
|
#[auto_serialize]
|
||||||
type variant = spanned<variant_>;
|
type variant = spanned<variant_>;
|
||||||
|
|
||||||
// FIXME: May want to just use path here, which would allow things like
|
|
||||||
// 'import ::foo'
|
|
||||||
#[auto_serialize]
|
|
||||||
type simple_path = [ident];
|
|
||||||
|
|
||||||
#[auto_serialize]
|
#[auto_serialize]
|
||||||
type path_list_ident_ = {name: ident, id: node_id};
|
type path_list_ident_ = {name: ident, id: node_id};
|
||||||
|
|
||||||
|
@ -609,13 +607,13 @@ enum view_path_ {
|
||||||
// or just
|
// or just
|
||||||
//
|
//
|
||||||
// foo::bar::baz (with 'baz =' implicitly on the left)
|
// foo::bar::baz (with 'baz =' implicitly on the left)
|
||||||
view_path_simple(ident, @simple_path, node_id),
|
view_path_simple(ident, @path, node_id),
|
||||||
|
|
||||||
// foo::bar::*
|
// foo::bar::*
|
||||||
view_path_glob(@simple_path, node_id),
|
view_path_glob(@path, node_id),
|
||||||
|
|
||||||
// foo::bar::{a,b,c}
|
// foo::bar::{a,b,c}
|
||||||
view_path_list(@simple_path, [path_list_ident], node_id)
|
view_path_list(@path, [path_list_ident], node_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[auto_serialize]
|
#[auto_serialize]
|
||||||
|
@ -676,9 +674,6 @@ type class_member = spanned<class_member_>;
|
||||||
enum class_member_ {
|
enum class_member_ {
|
||||||
instance_var(ident, @ty, class_mutability, node_id, privacy),
|
instance_var(ident, @ty, class_mutability, node_id, privacy),
|
||||||
class_method(@method)
|
class_method(@method)
|
||||||
// without constrained types, have to duplicate some stuff. or factor out
|
|
||||||
// item to separate out things with type params?
|
|
||||||
// (FIXME) where do we enforce that type params is empty?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[auto_serialize]
|
#[auto_serialize]
|
||||||
|
|
|
@ -175,8 +175,8 @@ fn is_exported(i: ident, m: _mod) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::view_path_list(path, ids, _) {
|
ast::view_path_list(path, ids, _) {
|
||||||
if vec::len(*path) == 1u {
|
if vec::len(path.node.idents) == 1u {
|
||||||
if i == path[0] { ret true; }
|
if i == path.node.idents[0] { ret true; }
|
||||||
for ids.each {|id|
|
for ids.each {|id|
|
||||||
if id.node.name == i { ret true; }
|
if id.node.name == i { ret true; }
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ fn is_exported(i: ident, m: _mod) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: glob-exports aren't supported yet.
|
// FIXME: glob-exports aren't supported yet. (#2006)
|
||||||
_ {}
|
_ {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2624,7 +2624,10 @@ fn parse_view_path(p: parser) -> @ast::view_path {
|
||||||
let mut hi = p.span.hi;
|
let mut hi = p.span.hi;
|
||||||
ret @spanned(lo, hi,
|
ret @spanned(lo, hi,
|
||||||
ast::view_path_simple(first_ident,
|
ast::view_path_simple(first_ident,
|
||||||
@path, p.get_id()));
|
@spanned(lo, hi,
|
||||||
|
{global: false, idents: path,
|
||||||
|
types: []}),
|
||||||
|
p.get_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
token::MOD_SEP {
|
token::MOD_SEP {
|
||||||
|
@ -2647,8 +2650,11 @@ fn parse_view_path(p: parser) -> @ast::view_path {
|
||||||
parse_path_list_ident, p).node;
|
parse_path_list_ident, p).node;
|
||||||
let mut hi = p.span.hi;
|
let mut hi = p.span.hi;
|
||||||
ret @spanned(lo, hi,
|
ret @spanned(lo, hi,
|
||||||
ast::view_path_list(@path, idents,
|
ast::view_path_list(@spanned(lo, hi,
|
||||||
p.get_id()));
|
{global: false,
|
||||||
|
idents: path,
|
||||||
|
types: []}), idents,
|
||||||
|
p.get_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// foo::bar::*
|
// foo::bar::*
|
||||||
|
@ -2656,8 +2662,11 @@ fn parse_view_path(p: parser) -> @ast::view_path {
|
||||||
p.bump();
|
p.bump();
|
||||||
let mut hi = p.span.hi;
|
let mut hi = p.span.hi;
|
||||||
ret @spanned(lo, hi,
|
ret @spanned(lo, hi,
|
||||||
ast::view_path_glob(@path,
|
ast::view_path_glob(@spanned(lo, hi,
|
||||||
p.get_id()));
|
{global: false,
|
||||||
|
idents: path,
|
||||||
|
types: []}),
|
||||||
|
p.get_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
_ { break; }
|
_ { break; }
|
||||||
|
@ -2669,7 +2678,10 @@ fn parse_view_path(p: parser) -> @ast::view_path {
|
||||||
let mut hi = p.span.hi;
|
let mut hi = p.span.hi;
|
||||||
let last = path[vec::len(path) - 1u];
|
let last = path[vec::len(path) - 1u];
|
||||||
ret @spanned(lo, hi,
|
ret @spanned(lo, hi,
|
||||||
ast::view_path_simple(last, @path,
|
ast::view_path_simple(last, @spanned(lo, hi,
|
||||||
|
{global: false,
|
||||||
|
idents: path,
|
||||||
|
types: []}),
|
||||||
p.get_id()));
|
p.get_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1426,31 +1426,23 @@ fn print_meta_item(s: ps, &&item: @ast::meta_item) {
|
||||||
end(s);
|
end(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_simple_path(s: ps, path: ast::simple_path) {
|
|
||||||
let mut first = true;
|
|
||||||
for path.each {|id|
|
|
||||||
if first { first = false; } else { word(s.s, "::"); }
|
|
||||||
word(s.s, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn print_view_path(s: ps, &&vp: @ast::view_path) {
|
fn print_view_path(s: ps, &&vp: @ast::view_path) {
|
||||||
alt vp.node {
|
alt vp.node {
|
||||||
ast::view_path_simple(ident, path, _) {
|
ast::view_path_simple(ident, path, _) {
|
||||||
if path[vec::len(*path)-1u] != ident {
|
if path.node.idents[vec::len(path.node.idents)-1u] != ident {
|
||||||
word_space(s, ident);
|
word_space(s, ident);
|
||||||
word_space(s, "=");
|
word_space(s, "=");
|
||||||
}
|
}
|
||||||
print_simple_path(s, *path);
|
print_path(s, path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::view_path_glob(path, _) {
|
ast::view_path_glob(path, _) {
|
||||||
print_simple_path(s, *path);
|
print_path(s, path, false);
|
||||||
word(s.s, "::*");
|
word(s.s, "::*");
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::view_path_list(path, idents, _) {
|
ast::view_path_list(path, idents, _) {
|
||||||
print_simple_path(s, *path);
|
print_path(s, path, false);
|
||||||
word(s.s, "::{");
|
word(s.s, "::{");
|
||||||
commasep(s, inconsistent, idents) {|s, w|
|
commasep(s, inconsistent, idents) {|s, w|
|
||||||
word(s.s, w.node.name)
|
word(s.s, w.node.name)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import driver::session::session;
|
import driver::session::session;
|
||||||
import syntax::codemap;
|
import syntax::codemap;
|
||||||
import syntax::ast;
|
import syntax::ast;
|
||||||
|
import syntax::ast_util::*;
|
||||||
import syntax::attr;
|
import syntax::attr;
|
||||||
|
|
||||||
export maybe_inject_libcore_ref;
|
export maybe_inject_libcore_ref;
|
||||||
|
@ -23,15 +24,15 @@ fn inject_libcore_ref(sess: session,
|
||||||
|
|
||||||
fn spanned<T: copy>(x: T) -> @ast::spanned<T> {
|
fn spanned<T: copy>(x: T) -> @ast::spanned<T> {
|
||||||
ret @{node: x,
|
ret @{node: x,
|
||||||
span: {lo: 0u, hi: 0u,
|
span: dummy_sp()};
|
||||||
expn_info: option::none}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let n1 = sess.next_node_id();
|
let n1 = sess.next_node_id();
|
||||||
let n2 = sess.next_node_id();
|
let n2 = sess.next_node_id();
|
||||||
|
|
||||||
let vi1 = spanned(ast::view_item_use("core", [], n1));
|
let vi1 = spanned(ast::view_item_use("core", [], n1));
|
||||||
let vp = spanned(ast::view_path_glob(@["core"], n2));
|
let vp = spanned(ast::view_path_glob(ident_to_path(dummy_sp(), "core"),
|
||||||
|
n2));
|
||||||
let vi2 = spanned(ast::view_item_import([vp]));
|
let vi2 = spanned(ast::view_item_import([vp]));
|
||||||
|
|
||||||
let vis = [vi1, vi2] + crate.node.module.view_items;
|
let vis = [vi1, vi2] + crate.node.module.view_items;
|
||||||
|
|
|
@ -3,6 +3,7 @@ import std::map::hashmap;
|
||||||
import syntax::ast::*;
|
import syntax::ast::*;
|
||||||
import syntax::print::pprust;
|
import syntax::print::pprust;
|
||||||
import syntax::ast_util;
|
import syntax::ast_util;
|
||||||
|
import middle::pat_util::*;
|
||||||
import syntax::ast_util::inlined_item_methods;
|
import syntax::ast_util::inlined_item_methods;
|
||||||
import syntax::{visit, codemap};
|
import syntax::{visit, codemap};
|
||||||
import driver::session::session;
|
import driver::session::session;
|
||||||
|
@ -233,9 +234,7 @@ fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {
|
||||||
let (id, name) = alt vp.node {
|
let (id, name) = alt vp.node {
|
||||||
view_path_simple(nm, _, id) { (id, nm) }
|
view_path_simple(nm, _, id) { (id, nm) }
|
||||||
view_path_glob(pth, id) | view_path_list(pth, _, id) {
|
view_path_glob(pth, id) | view_path_list(pth, _, id) {
|
||||||
// should be a constraint on the type
|
(id, path_to_ident(pth))
|
||||||
assert (vec::is_not_empty(*pth));
|
|
||||||
(id, vec::last(*pth))
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cx.map.insert(id, node_export(vp, extend(cx, name)));
|
cx.map.insert(id, node_export(vp, extend(cx, name)));
|
||||||
|
|
|
@ -236,15 +236,16 @@ fn map_crate(e: @env, c: @ast::crate) {
|
||||||
iter_effective_import_paths(*i) { |vp|
|
iter_effective_import_paths(*i) { |vp|
|
||||||
alt vp.node {
|
alt vp.node {
|
||||||
ast::view_path_simple(name, path, id) {
|
ast::view_path_simple(name, path, id) {
|
||||||
e.imports.insert(id, todo(name, path, vp.span, sc));
|
e.imports.insert(id, todo(name, @path.node.idents, vp.span,
|
||||||
|
sc));
|
||||||
}
|
}
|
||||||
ast::view_path_glob(path, id) {
|
ast::view_path_glob(path, id) {
|
||||||
e.imports.insert(id, is_glob(path, sc, vp.span));
|
e.imports.insert(id, is_glob(@path.node.idents, sc, vp.span));
|
||||||
}
|
}
|
||||||
ast::view_path_list(mod_path, idents, _) {
|
ast::view_path_list(mod_path, idents, _) {
|
||||||
for idents.each {|ident|
|
for idents.each {|ident|
|
||||||
let t = todo(ident.node.name,
|
let t = todo(ident.node.name,
|
||||||
@(*mod_path + [ident.node.name]),
|
@(mod_path.node.idents + [ident.node.name]),
|
||||||
ident.span, sc);
|
ident.span, sc);
|
||||||
e.imports.insert(ident.node.id, t);
|
e.imports.insert(ident.node.id, t);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +298,7 @@ fn map_crate(e: @env, c: @ast::crate) {
|
||||||
iter_effective_import_paths(*vi) { |vp|
|
iter_effective_import_paths(*vi) { |vp|
|
||||||
alt vp.node {
|
alt vp.node {
|
||||||
ast::view_path_glob(path, _) {
|
ast::view_path_glob(path, _) {
|
||||||
alt follow_import(*e, sc, *path, vp.span) {
|
alt follow_import(*e, sc, path.node.idents, vp.span) {
|
||||||
some(imp) {
|
some(imp) {
|
||||||
let glob = {def: imp, path: vp};
|
let glob = {def: imp, path: vp};
|
||||||
alt list::head(sc) {
|
alt list::head(sc) {
|
||||||
|
@ -2083,8 +2084,8 @@ fn check_exports(e: @env) {
|
||||||
check_export(e, ident, _mod, id, vi);
|
check_export(e, ident, _mod, id, vi);
|
||||||
}
|
}
|
||||||
ast::view_path_list(path, ids, node_id) {
|
ast::view_path_list(path, ids, node_id) {
|
||||||
let id = if vec::len(*path) == 1u {
|
let id = if vec::len(path.node.idents) == 1u {
|
||||||
path[0]
|
path.node.idents[0]
|
||||||
} else {
|
} else {
|
||||||
e.sess.span_fatal(vp.span, "bad export name-list")
|
e.sess.span_fatal(vp.span, "bad export name-list")
|
||||||
};
|
};
|
||||||
|
@ -2151,12 +2152,12 @@ fn find_impls_in_view_item(e: env, vi: @ast::view_item,
|
||||||
alt vp.node {
|
alt vp.node {
|
||||||
ast::view_path_simple(name, pt, id) {
|
ast::view_path_simple(name, pt, id) {
|
||||||
let mut found = [];
|
let mut found = [];
|
||||||
if vec::len(*pt) == 1u {
|
if vec::len(pt.node.idents) == 1u {
|
||||||
option::iter(sc) {|sc|
|
option::iter(sc) {|sc|
|
||||||
list::iter(sc) {|level|
|
list::iter(sc) {|level|
|
||||||
if vec::len(found) == 0u {
|
if vec::len(found) == 0u {
|
||||||
for vec::each(*level) {|imp|
|
for vec::each(*level) {|imp|
|
||||||
if imp.ident == pt[0] {
|
if imp.ident == pt.node.idents[0] {
|
||||||
found += [@{ident: name with *imp}];
|
found += [@{ident: name with *imp}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue