Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对于函数实参列表的解析-关于字符串 #43

Open
cookie0825 opened this issue Mar 31, 2023 · 2 comments
Open

对于函数实参列表的解析-关于字符串 #43

cookie0825 opened this issue Mar 31, 2023 · 2 comments

Comments

@cookie0825
Copy link

String b = "asd";
foo("b",b);

现在的解析结果输出的是 "b b",从解析结果难以区分哪一个是字符串,哪一个是变量名
是否可以区别字符串与变量

@Lynn-Dai
Copy link
Collaborator

应该会有对应的parameter type

@cookie0825
Copy link
Author

示例代码

package org.example.ex1;

public class Test
{
    public Test()
    {

    }

    public void testFoo()
    {
        String b = "str";
        foo("b", b);
    }

    public void foo(String a, String b)
    {

    }
}

解析结果及问题描述

我理解的parameter type是函数形参的类型
即对于函数foo(String a, String b)解析的parameter type 为String,String

{
      "external": false,
      "id": 8,
      "qualifiedName": "org.example.ex1.Test.foo",
      "name": "foo",
      "category": "Method",
      "parentId": 4,
      "File": "src/main/java/org/example/ex1/Test.java",
      "additionalBin": {
        "binNum": 1,
        "binPath": "F:/code/ex1"
      },
      "enhancement": {
        "synchronized": false,
        "static": false,
        "getter": false,
        "setter": false,
        "public": true,
        "delegator": false,
        "constructor": false,
        "override": false,
        "abstract": false,
        "recursive": false
      },
      "location": {
        "startLine": 16,
        "endLine": 19,
        "startColumn": 4,
        "endColumn": 4
      },
      "modifiers": "public",
      "parameter": {
        "types": "java.lang.String java.lang.String",
        "names": "a b"
      },
      "rawType": "void"
    }

当我对foo("b",b)解析的时候,解析出的arguments为"b b",根据函数的parameter type似乎难以区分两个b有何区别

{
      "src": 6,
      "dest": 8,
      "values": {
        "loc": {
          "startLine": 13,
          "endLine": 13,
          "startColumn": 8,
          "endColumn": 18
        },
        "Call": 1,
        "arguments": "b b"
      }
    }

是否可以在解析结果中通过添加双引号的形式将二者进行区分

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants