Remove archive argument from readComponent

This commit is contained in:
2021-09-30 15:03:30 -06:00
parent 3821ac01b7
commit 0a29bd5655
3 changed files with 7 additions and 8 deletions

View File

@@ -7,7 +7,7 @@
`(.exists .components ,e ,(symbolName componentType)))
// Changes to the object returned by (readComponent) will not be saved! Use (withWritableComponents) for making changes
(defMacro readComponent [archive e componentType]
(defMacro readComponent [e componentType]
`(let [componentData (dictGet (the Map<String,String> .components ,e) ,(symbolName componentType))]
(print (+ "reading " componentData " as " ,(symbolName componentType) " for " .id ,e))
(the nat.components ,componentType
@@ -33,7 +33,7 @@
(symbol)]
(doFor [name type] bindingPairs
(bindingList.push `&mut ,name)
(bindingList.push `(readComponent ,archive ,e ,type))
(bindingList.push `(readComponent ,e ,type))
(saveList.push `(dictSet .components ,e ,(symbolName type) (tink.Json.stringify (the nat.components ,type ,name)))))
`(let [,@bindingList
,retValSymbol {,@body}]
@@ -49,16 +49,15 @@
,retValSymbol)))
// Create a system that selects Entries according to a single string component (i.e. Name or Author) matching the given value
(defMacro stringComponentSystem [archive componentType value process]
(defMacro stringComponentSystem [componentType value process]
`(new System
(lambda [archive :nat.Entry e]
?(and (hasComponent e ,componentType)
(= ,value (readComponent ,archive e ,componentType))))
(= ,value (readComponent e ,componentType))))
,process))
(function tagList [archive e]
(let [t
(readComponent archive e Tags)]
(let [t (readComponent e Tags)]
(collect (t.keys))))
(function tagsMatch [archive e tagsBoolExp]