Move functions from syntax::ast to syntax::ast_util

This leaves syntax::ast just defining the AST, which strikes me as somewhat
nicer
This commit is contained in:
Brian Anderson 2011-08-21 21:44:41 -07:00
parent a3affaa20f
commit 152cbaade7
33 changed files with 358 additions and 314 deletions

View file

@ -2,6 +2,7 @@
import driver::session;
import syntax::ast;
import syntax::ast_util;
import lib::llvm::False;
import lib::llvm::llvm;
import lib::llvm::mk_object_file;
@ -262,7 +263,7 @@ fn resolve_crate_deps(e: env, cdata: &@[u8]) -> cstore::cnum_map {
log "need to load it";
// This is a new one so we've got to load it
// FIXME: Need better error reporting than just a bogus span
let fake_span = ast::dummy_sp();
let fake_span = ast_util::dummy_sp();
let local_cnum = resolve_crate(e, cname, [], fake_span);
cnum_map.insert(extrn_cnum, local_cnum);
}

View file

@ -7,6 +7,7 @@ import std::str;
import std::io;
import std::map::hashmap;
import syntax::ast;
import syntax::ast_util;
import front::attr;
import middle::ty;
import common::*;
@ -335,7 +336,7 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] {
let meta_item = meta_items[0];
attrs +=
[{node: {style: ast::attr_outer, value: *meta_item},
span: ast::dummy_sp()}];
span: ast_util::dummy_sp()}];
}
}
option::none. { }

View file

@ -10,6 +10,8 @@ import std::option::none;
import std::ebml;
import std::map;
import syntax::ast::*;
import syntax::ast_util;
import syntax::ast_util::local_def;
import common::*;
import middle::trans_common::crate_ctxt;
import middle::ty;
@ -71,7 +73,7 @@ fn encode_native_module_item_paths(ebml_w: &ebml::writer, nmod: &native_mod,
fn encode_module_item_paths(ebml_w: &ebml::writer, module: &_mod,
path: &[str], index: &mutable [entry<str>]) {
for it: @item in module.items {
if !is_exported(it.ident, module) { cont; }
if !ast_util::is_exported(it.ident, module) { cont; }
alt it.node {
item_const(_, _) {
add_to_index(ebml_w, path, index, it.ident);

View file

@ -8,7 +8,8 @@ import std::option::none;
import std::option::some;
import syntax::ast;
import syntax::ast::*;
import ast::respan;
import syntax::ast_util;
import syntax::ast_util::respan;
import middle::ty;
export parse_def_id;
@ -106,7 +107,7 @@ fn parse_path(st: @pstate, sd: str_def) -> ast::path {
':' { next(st); next(st); }
c {
if c == '(' {
ret respan(ast::dummy_sp(),
ret respan(ast_util::dummy_sp(),
{global: false, idents: idents, types: []});
} else { idents += [parse_ident_(st, sd, is_last)]; }
}
@ -152,7 +153,7 @@ fn parse_ty_constr_arg(st: @pstate, sd: str_def) ->
fn parse_constr<@T>(st: @pstate, sd: str_def, pser: arg_parser<T>) ->
@ty::constr_general<T> {
let sp = ast::dummy_sp(); // FIXME: use a real span
let sp = ast_util::dummy_sp(); // FIXME: use a real span
let args: [@sp_constr_arg<T>] = [];
let pth: path = parse_path(st, sd);
let ignore: char = next(st) as char;