Symbolk / Code2Graph

Towards converting multilingual source code into one language-agnostic graph representation.
42 stars 7 forks source link

bug: rename后新URI中修改了不应该发生变动的layer #142

Open TsukimiRini opened 2 years ago

TsukimiRini commented 2 years ago
image

input:

def://sagan-site/src/main/java/sagan/site/blog/support/BlogAdminController.java[language=FILE]//BlogAdminController/newPost/model.addAttribute[language=JAVA]//formats[language=ANY]
def://sagan-site/src/main/java/sagan/site/blog/support/BlogAdminController.java[language=FILE]//BlogAdminController/newPost/model.addAttribute[language=JAVA]//formatsObj[language=ANY]

rename pair:

use://sagan-site/src/main/resources/templates/admin/blog/new.html[language=FILE]//html/body/form/div/div/div/div/div/select/option/data-th-each[language=HTML]//${formats}[language=ANY]
use://sagan-site/src/main/resources/templates/admin/blog/resources/templates/admin/blog/new.html[language=FILE]//html/body/form/div/div/div/div/div/select/option/data-th-each[language=HTML]//${formatsObj}[language=ANY]

在图中例子里,oldURI的file层为sagan-site/src/main/resources/templates/admin/blog/new.html,rename后newURI的file层变成sagan-site/src/main/resources/templates/admin/blog/resources/templates/admin/blog/new.html

TsukimiRini commented 2 years ago

@shigma uri tree(仅供参考)

def://sagan-site/src/main/java/sagan/site/blog/support/BlogAdminController.java[language=FILE]//BlogAdminController/newPost/return[language=JAVA]//admin\\/blog\\/new[language=ANY]
def://sagan-site/src/main/java/sagan/site/blog/support/BlogAdminController.java[language=FILE]//BlogAdminController/newPost/model.addAttribute[language=JAVA]//formats[language=ANY]
use://sagan-site/src/main/resources/templates/admin/blog/new.html[language=FILE]//html/body/form/div/div/div/div/div/select/option/data-th-each[language=HTML]//${formats}[language=ANY]
shigma commented 2 years ago
  r-addAttr:
    def:
      lang: JAVA
      file: (&javaFile).java
      identifier: '(&functionName)/(&modelName).addAttribute'
      inline:
        identifier: (name)
    use:
      lang: HTML
-     file: (&htmlFile).html
+     file: (&htmlFile...).html
      identifier: "**"
      inline:
        identifier: "${(name)}"
TsukimiRini commented 2 years ago

@shigma config按上一条回复更改后,addAttr规则无法匹配得到结果 用下面这个例子试试

r-htmlPath-strict,def://sagan-site/src/main/resources/templates/admin/team/edit.html[language=FILE],def://sagan-site/src/main/java/sagan/site/team/support/TeamAdminController.java[language=FILE]//TeamAdminController/editProfileForm/return[language=JAVA]//admin\\/team\\/edit[language=ANY]
r-addAttr,def://sagan-site/src/main/java/sagan/site/team/support/TeamAdminController.java[language=FILE]//TeamAdminController/editProfileForm/model.addAttribute[language=JAVA]//formAction[language=ANY],use://sagan-site/src/main/resources/templates/admin/team/edit.html[language=FILE]//html/body/form/data-th-action[language=HTML]//${formAction}[language=ANY]