GULPF / nimquery

Nim library for querying HTML using CSS-selectors (like JavaScripts document.querySelector)
MIT License
134 stars 8 forks source link

Incorrectly parses query at compiletime #9

Closed SolitudeSF closed 4 years ago

SolitudeSF commented 4 years ago
const queryTime = parseHtmlQuery(".views-row-first .views-field-changed")
echo queryTime

yields

(queries: @[@[(demands: @[[~='']], combinator: cmDescendants), (demands: @[[~='']], combinator: cmLeaf)]], options: {optUniqueIds, optUnicodeIdentifiers, optSimpleNot}, queryStr: ".views-row-first .views-field-changed")

changing const -> let yields

(queries: @[@[(demands: @[[class~='views-row-first']], combinator: cmDescendants), (demands: @[[class~='views-field-changed']], combinator: cmLeaf)]], options: {optUniqueIds, optUnicodeIdentifiers, optSimpleNot}, queryStr: ".views-row-first .views-field-changed")
SolitudeSF commented 4 years ago

looks like its a nim bug. i can verify that data is constructed correctly, by echoing result of parseHtmlQuery, but it doesnt survive assignment to const.

SolitudeSF commented 4 years ago

okay, object variant dont work at compile time and according to araq thats by design. yikes.