Skip to content

Empty ddg after adg creation with mk_adg  #17

@lyriccoder

Description

@lyriccoder

Ddg is empty always if f create adg with md_adg method:

from program_graphs import ADG
from program_graphs.adg.parser.java.parser import mk_adg, mk_empty_adg
from program_graphs.adg.parser.java.utils import parse_ast_tree_sitter
tt = '''class Foo { protected void prepareBarHighlight(float x, float y1, float y2, float barspaceHalf,
                                       Transformer trans) {

        float barWidth = 0.5f;

        float left = x - barWidth + barspaceHalf;
        float right = x + barWidth - barspaceHalf;
        float top = y1;
        float bottom = y2;

        mBarRect.set(left, top, right, bottom);

        trans.rectValueToPixel(mBarRect, mAnimator.getPhaseY());
    }}
'''
ast = parse_ast_tree_sitter(tt)
for x in __traverse(ast):
    if x.type == 'method_declaration':
        break
adg_method = mk_empty_adg()
mk_adg(x, adg_method, parent_adg_node=None, source=source_code_bytes)
ddg = adg_method.to_ddg()
print(ddg)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions