Really check everything in check_all

This commit is contained in:
David Tolnay 2020-04-30 20:46:24 -07:00
parent a83301ce5b
commit 6b6423edfb
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 8 additions and 6 deletions

View File

@ -30,10 +30,7 @@ pub(crate) fn typecheck(namespace: &Namespace, apis: &[Api], types: &Types) -> R
}
fn do_typecheck(cx: &mut Check) {
for segment in cx.namespace {
ident::check(cx, segment);
}
ident::check_all(cx, cx.apis);
ident::check_all(cx, cx.namespace, cx.apis);
for ty in cx.types {
match ty {

View File

@ -1,8 +1,9 @@
use crate::syntax::check::Check;
use crate::syntax::namespace::Namespace;
use crate::syntax::{error, Api};
use proc_macro2::Ident;
pub(crate) fn check(cx: &mut Check, ident: &Ident) {
fn check(cx: &mut Check, ident: &Ident) {
let s = ident.to_string();
if s.starts_with("cxxbridge") {
cx.error(ident, error::CXXBRIDGE_RESERVED.msg);
@ -12,7 +13,11 @@ pub(crate) fn check(cx: &mut Check, ident: &Ident) {
}
}
pub(crate) fn check_all(cx: &mut Check, apis: &[Api]) {
pub(crate) fn check_all(cx: &mut Check, namespace: &Namespace, apis: &[Api]) {
for segment in namespace {
check(cx, segment);
}
for api in apis {
match api {
Api::Include(_) => {}