Make sure the global namespace is always searched first.

This commit is contained in:
Stephen Chung
2021-11-05 23:22:05 +08:00
parent 46e99df9cd
commit eeca8c90aa
20 changed files with 82 additions and 11 deletions

View File

@@ -177,6 +177,8 @@ macro_rules! reg_functions {
}
def_package!(crate:ArithmeticPackage:"Basic arithmetic", lib, {
lib.standard = true;
combine_with_exported_module!(lib, "int", int_functions);
reg_functions!(lib += signed_basic; INT);

View File

@@ -9,6 +9,8 @@ use std::prelude::v1::*;
use std::{any::TypeId, cmp::Ordering, mem};
def_package!(crate:BasicArrayPackage:"Basic array utilities.", lib, {
lib.standard = true;
combine_with_exported_module!(lib, "array", array_functions);
// Register array iterator

View File

@@ -4,6 +4,8 @@ use crate::{def_package, FnPtr, ImmutableString, NativeCallContext};
use std::prelude::v1::*;
def_package!(crate:BasicFnPackage:"Basic Fn functions.", lib, {
lib.standard = true;
combine_with_exported_module!(lib, "FnPtr", fn_ptr_functions);
});

View File

@@ -292,6 +292,8 @@ macro_rules! reg_range {
}
def_package!(crate:BasicIteratorPackage:"Basic range iterators.", lib, {
lib.standard = true;
reg_range!(lib | "range" => INT);
#[cfg(not(feature = "only_i32"))]

View File

@@ -43,5 +43,7 @@ mod core_functions {
}
def_package!(crate:LanguageCorePackage:"Language core functions.", lib, {
lib.standard = true;
combine_with_exported_module!(lib, "language_core", core_functions);
});

View File

@@ -38,6 +38,8 @@ macro_rules! reg_functions {
}
def_package!(crate:LogicPackage:"Logical operators.", lib, {
lib.standard = true;
#[cfg(not(feature = "only_i32"))]
#[cfg(not(feature = "only_i64"))]
{

View File

@@ -10,6 +10,8 @@ use std::prelude::v1::*;
use crate::Array;
def_package!(crate:BasicMapPackage:"Basic object map utilities.", lib, {
lib.standard = true;
combine_with_exported_module!(lib, "map", map_functions);
});

View File

@@ -62,6 +62,8 @@ macro_rules! reg_functions {
}
def_package!(crate:BasicMathPackage:"Basic mathematic functions.", lib, {
lib.standard = true;
// Integer functions
combine_with_exported_module!(lib, "int", int_functions);

View File

@@ -10,6 +10,8 @@ use std::prelude::v1::*;
use crate::def_package;
def_package!(crate:CorePackage:"_Core_ package containing basic facilities.", lib, {
lib.standard = true;
LanguageCorePackage::init(lib);
ArithmeticPackage::init(lib);
LogicPackage::init(lib);

View File

@@ -13,6 +13,8 @@ use std::prelude::v1::*;
use crate::def_package;
def_package!(crate:StandardPackage:"_Standard_ package containing all built-in features.", lib, {
lib.standard = true;
CorePackage::init(lib);
BasicMathPackage::init(lib);
#[cfg(not(feature = "no_index"))]

View File

@@ -16,6 +16,8 @@ pub const FUNC_TO_STRING: &str = "to_string";
pub const FUNC_TO_DEBUG: &str = "to_debug";
def_package!(crate:BasicStringPackage:"Basic string utilities, including printing.", lib, {
lib.standard = true;
combine_with_exported_module!(lib, "print_debug", print_debug_functions);
combine_with_exported_module!(lib, "number_formatting", number_formatting);
});

View File

@@ -9,6 +9,8 @@ use std::{any::TypeId, mem};
use super::string_basic::{print_with_func, FUNC_TO_STRING};
def_package!(crate:MoreStringPackage:"Additional string utilities, including string building.", lib, {
lib.standard = true;
combine_with_exported_module!(lib, "string", string_functions);
});

View File

@@ -16,6 +16,8 @@ use std::time::{Duration, Instant};
use instant::{Duration, Instant};
def_package!(crate:BasicTimePackage:"Basic timing utilities.", lib, {
lib.standard = true;
// Register date/time functions
combine_with_exported_module!(lib, "time", time_functions);
});