1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Merge branch 'master' into ev

This commit is contained in:
Calvin Rose 2020-10-10 09:04:05 -05:00
commit ea45165db8
3 changed files with 5 additions and 4 deletions

View File

@ -262,7 +262,7 @@ build/janet.pc: $(JANET_TARGET)
echo 'Libs: -L$${libdir} -ljanet' >> $@ echo 'Libs: -L$${libdir} -ljanet' >> $@
echo 'Libs.private: $(CLIBS)' >> $@ echo 'Libs.private: $(CLIBS)' >> $@
install: $(JANET_TARGET) build/janet.pc build/jpm install: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.pc build/jpm
mkdir -p '$(DESTDIR)$(BINDIR)' mkdir -p '$(DESTDIR)$(BINDIR)'
cp $(JANET_TARGET) '$(DESTDIR)$(BINDIR)/janet' cp $(JANET_TARGET) '$(DESTDIR)$(BINDIR)/janet'
mkdir -p '$(DESTDIR)$(INCLUDEDIR)/janet' mkdir -p '$(DESTDIR)$(INCLUDEDIR)/janet'

View File

@ -1392,7 +1392,7 @@
arr) arr)
(defn pairs (defn pairs
"Get the values of an associative data structure." "Get the key-value pairs of an associative data structure."
[x] [x]
(def arr (array/new (length x))) (def arr (array/new (length x)))
(var k (next x nil)) (var k (next x nil))
@ -2488,7 +2488,7 @@
(tuple import* (string path) ;argm)) (tuple import* (string path) ;argm))
(defmacro use (defmacro use
"Similar to import, but imported bindings are not prefixed with a namespace "Similar to import, but imported bindings are not prefixed with a module
identifier. Can also import multiple modules in one shot." identifier. Can also import multiple modules in one shot."
[& modules] [& modules]
~(do ,;(map |~(,import* ,(string $) :prefix "") modules))) ~(do ,;(map |~(,import* ,(string $) :prefix "") modules)))

View File

@ -449,7 +449,8 @@ void janet_cfuns(JanetTable *env, const char *regprefix, const JanetReg *cfuns)
void janet_register_abstract_type(const JanetAbstractType *at) { void janet_register_abstract_type(const JanetAbstractType *at) {
Janet sym = janet_csymbolv(at->name); Janet sym = janet_csymbolv(at->name);
if (!(janet_checktype(janet_table_get(janet_vm_abstract_registry, sym), JANET_NIL))) { Janet check = janet_table_get(janet_vm_abstract_registry, sym);
if (!janet_checktype(check, JANET_NIL) && at != janet_unwrap_pointer(check)) {
janet_panicf("cannot register abstract type %s, " janet_panicf("cannot register abstract type %s, "
"a type with the same name exists", at->name); "a type with the same name exists", at->name);
} }