packages feed

dhscanner-bitcode 1.1.0 → 2.0.0

raw patch · 2 files changed

+14/−4 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Callable: [funcSourceBodyLength] :: FunctionContent -> Word
+ Callable: [lambdaSourceBodyLength] :: LambdaContent -> Word
+ Callable: [methodSourceBodyLength] :: MethodContent -> Word
+ Callable: numOriginalSourceInstructions :: Callable -> Word
- Callable: FunctionContent :: FuncName -> Cfg -> [Annotation] -> Location -> FunctionContent
+ Callable: FunctionContent :: FuncName -> Cfg -> [Annotation] -> Location -> Word -> FunctionContent
- Callable: LambdaContent :: Cfg -> Location -> LambdaContent
+ Callable: LambdaContent :: Cfg -> Location -> Word -> LambdaContent
- Callable: MethodContent :: MethodName -> ClassName -> [HostingClassSuper] -> Cfg -> Location -> MethodContent
+ Callable: MethodContent :: MethodName -> ClassName -> [HostingClassSuper] -> Cfg -> Location -> Word -> MethodContent

Files

dhscanner-bitcode.cabal view
@@ -20,7 +20,7 @@     in mind. The commands resemble an abstract RISC-style assembley, motivated by keeping
     later-phases analyses as simple as possible.
 
-version:            1.1.0
+version:            2.0.0
 license:            GPL-3.0-only
 license-file:       LICENSE
 author:             OrenGitHub
src/Callable.hs view
@@ -68,7 +68,8 @@          hostingClassName :: Token.ClassName,
          hostingClassSupers :: [ HostingClassSuper ],
          methodBody :: Cfg,
-         methodLocation :: Location
+         methodLocation :: Location,
+         methodSourceBodyLength :: Word -- ^ number of source-level statements ( see @stmtMethodBody@ in "Ast" )
      }
      deriving ( Show, Eq, Ord, Generic, ToJSON, FromJSON )
 
@@ -76,7 +77,8 @@    = LambdaContent
      {
          lambdaBody :: Cfg,
-         lambdaLocation :: Location
+         lambdaLocation :: Location,
+         lambdaSourceBodyLength :: Word -- ^ number of source-level statements ( see @expLambdaBody@ in "Ast" )
      }
      deriving ( Show, Eq, Ord, Generic, ToJSON, FromJSON )
 
@@ -102,7 +104,15 @@          funcName :: Token.FuncName,
          funcBody :: Cfg,
          funcAnnotations :: [ Annotation ],
-         funcLocation :: Location
+         funcLocation :: Location,
+         funcSourceBodyLength :: Word -- ^ number of source-level statements ( see @stmtFuncBody@ in "Ast" )
      }
      deriving ( Show, Eq, Ord, Generic, ToJSON, FromJSON )
+
+-- | Number of source-level statements in the callable's body ( see "Ast" ). Returns @0@ for 'Script'.
+numOriginalSourceInstructions :: Callable -> Word
+numOriginalSourceInstructions (Method   m) = methodSourceBodyLength m
+numOriginalSourceInstructions (Lambda   l) = lambdaSourceBodyLength l
+numOriginalSourceInstructions (Function f) = funcSourceBodyLength   f
+numOriginalSourceInstructions (Script   _) = 0