M fugue.janet => fugue.janet +14 -15
@@ 453,21 453,20 @@
```
[name proto args & body]
(warn-proto-method-shadow name proto)
- (upscope
- (let [current-binding (dyn name)]
- @[(unless (and current-binding (function? (current-binding :value)))
- (maclintf :strict "Defining generic function for method %s ..." (string name))
- (defgeneric* name nil args raise-sentinel))
-
- (let [method-name (keyword name)
- full-method-name (symbol proto "-" name)]
- ~(,put ,proto
- ,method-name
- (fn ,full-method-name
- ,args
- (let [__parent (table/getproto ,proto)
- __super (__parent ,method-name)]
- ,;body))))])))
+ (let [current-binding (dyn name)]
+ @[(unless (and current-binding (function? (current-binding :value)))
+ (maclintf :strict "Defining generic function for method %s ..." (string name))
+ (defgeneric* name nil args raise-sentinel))
+
+ (let [method-name (keyword name)
+ full-method-name (symbol proto "-" name)]
+ ~(,put ,proto
+ ,method-name
+ (fn ,full-method-name
+ ,args
+ (let [__parent (table/getproto ,proto)
+ __super (__parent ,method-name)]
+ ,;body))))]))
#
# Multimethod Helpers
M test/fugue.janet => test/fugue.janet +4 -5
@@ 13,11 13,10 @@
(is (= fugue/Root (table/getproto proto))))
(defmacro- inst-tests [proto inst]
- (upscope
- @[~(is ,(symbol proto "?") ,inst)
- ~(is ,(symbol proto "*?") ,inst)
- ~(is (not (fugue/prototype? ,inst)))
- ~(is (= ,proto (table/getproto ,inst)))]))
+ @[~(is ,(symbol proto "?") ,inst)
+ ~(is ,(symbol proto "*?") ,inst)
+ ~(is (not (fugue/prototype? ,inst)))
+ ~(is (= ,proto (table/getproto ,inst)))])
(defmacro- accessor-tests [accessor objs &opt refute]
~(each obj ,objs (is (,(if refute not= =) (,accessor obj) (obj ,(keyword accessor))))))