fix transformToFieldExp return behavior
This commit is contained in:
@@ -292,7 +292,7 @@
|
||||
(cc f)
|
||||
(return)))
|
||||
// Check for field access
|
||||
(whenLet [exp (transformToFieldExp exp)]
|
||||
(whenLet [exp (transformToFieldExp exp true)]
|
||||
(evalCC exp cc)
|
||||
(return))
|
||||
// Check for ident aliases
|
||||
@@ -321,11 +321,12 @@
|
||||
(cc outputs)))
|
||||
|
||||
// Check if an identifier has field access in it, return true if transform it to FieldExp
|
||||
(method transformToFieldExp [:ReaderExp exp]
|
||||
(method transformToFieldExp [:ReaderExp exp &opt :Bool nullIfNot]
|
||||
(case exp.def
|
||||
((Symbol ident)
|
||||
(let [idx (ident.indexOf ".")]
|
||||
(unless (= -1 idx)
|
||||
(if (= -1 idx)
|
||||
(return (if nullIfNot null exp))
|
||||
(let [parts (ident.split ".")
|
||||
&mut newExp (makeExp (Symbol (first parts)))]
|
||||
(doFor part (parts.slice 1)
|
||||
@@ -333,4 +334,4 @@
|
||||
(when safe (set part (part.substr 1)))
|
||||
(set newExp (makeExp (FieldExp part newExp safe)))))
|
||||
(return newExp)))))
|
||||
(otherwise (return null))))
|
||||
(otherwise (return (if nullIfNot null exp)))))
|
||||
Reference in New Issue
Block a user