@Test
public void testTargetInference() throws Exception {
compile("import java.util.Collections; " + "import java.util.List; "
+ "public class A { public static void processStringList(List<String> stringList) {}}");
SymbolType st = new SymbolType(getClassLoader().loadClass("A"));
SymbolTable symTable = getSymbolTable();
symTable.pushScope();
symTable.pushSymbol("A", ReferenceType.TYPE, st, null);
MethodCallExpr expr =
(MethodCallExpr) ASTManager.parse(Expression.class, "A.processStringList(Collections.emptyList());");
HashMap<String, Object> ctx = new HashMap<String, Object>();
expressionAnalyzer.visit(expr, ctx);
SymbolType type = (SymbolType) expr.getSymbolData();
Assert.assertNotNull(type);
Assert.assertEquals("void", type.getName());
}
TypeVisitorAdapterTest.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:javalang-compiler
作者:
评论列表
文章目录