haskell-gi 0.22.2 → 0.22.3
raw patch · 3 files changed
+19/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- haskell-gi.cabal +1/−1
- lib/Data/GI/GIR/Field.hs +14/−5
ChangeLog.md view
@@ -1,3 +1,7 @@+### 0.22.3+++ Sometimes struct fields marked as not introspectable contain invalid introspection info. We are lenient in these cases with parsing errors, and simply ignore the fields.+ ### 0.21.5 + Add support for callback-valued properties.
haskell-gi.cabal view
@@ -1,5 +1,5 @@ name: haskell-gi-version: 0.22.2+version: 0.22.3 synopsis: Generate Haskell bindings for GObject Introspection capable libraries description: Generate Haskell bindings for GObject Introspection capable libraries. This includes most notably Gtk+, but many other libraries in the GObject ecosystem provide introspection data too.
lib/Data/GI/GIR/Field.hs view
@@ -5,7 +5,9 @@ , parseFields ) where -import Data.Maybe (isJust)+import Control.Monad.Except (catchError, throwError)++import Data.Maybe (isJust, catMaybes) import Data.Monoid ((<>)) import Data.Text (Text, isSuffixOf) @@ -33,7 +35,7 @@ -- non-introspectable fields too (but set fieldVisible = False for -- them), this is necessary since they affect the computation of -- offsets of fields and sizes of containing structs.-parseField :: Parser Field+parseField :: Parser (Maybe Field) parseField = do name <- getAttr "name" deprecated <- parseDeprecation@@ -44,7 +46,13 @@ introspectable <- optionalAttr "introspectable" True parseBool private <- optionalAttr "private" False parseBool doc <- parseDocumentation- (t, isPtr, callback) <-+ -- Sometimes fields marked as not introspectable contain invalid+ -- introspection info. We are lenient in these cases with parsing+ -- errors, and simply ignore the fields.+ flip catchError (\e -> if (not introspectable) && private+ then return Nothing+ else throwError e) $ do+ (t, isPtr, callback) <- if introspectable then do callbacks <- parseChildrenWithLocalName "callback" parseCallback@@ -68,7 +76,8 @@ return (t, fmap ("*" `isSuffixOf`) ct, Nothing) [n] -> return (TInterface n, Just True, Nothing) _ -> parseError "Multiple callbacks in field"- return $ Field {++ return $ Just $ Field { fieldName = name , fieldVisible = introspectable && not private , fieldType = t@@ -83,4 +92,4 @@ } parseFields :: Parser [Field]-parseFields = parseAllChildrenWithLocalName "field" parseField+parseFields = catMaybes <$> parseAllChildrenWithLocalName "field" parseField