petertsehsun / crystalsaf

Automatically exported from code.google.com/p/crystalsaf
0 stars 1 forks source link

Field initializers return null for Utilities.getMethodDeclaration(...) #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If you call the method, Utilities.getMethodDeclaration(...) on an ASTNode 
that is part of a field initializer, it returns null. This seems to make 
sense, except that Crystal pretends like field initializers are part of 
class constructors for the purposes of data-flow analysis.

Maybe we need two methods to replace getMethodDeclaration(...). One which 
returns the first MethodDecl node above the given node in the AST, and 
another to return the MethodDecl that the given node is in for the purposes 
of dataflow analysis.

Original issue reported on code.google.com by nels.bec...@gmail.com on 15 Sep 2008 at 3:26

GoogleCodeExporter commented 9 years ago
The problem with field initializers is that Crystal's CFG pretends they are in
*every* constructor.  Thus, it's not clear what to return from 
getMethodDeclaration()
even for the purposes of dataflow analysis.

In the context of dataflow analyses, a suggestion has been to return merged 
results
for the requested field initializer from all constructors.  The problem with 
that is
that we currently store analysis information only for the most recently 
analyzed method.

Original comment by kevin.bi...@gmail.com on 29 Sep 2008 at 6:14