SimpleNameScopeProviderTest.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:xtext-core 作者:
@Test public void testGetAllContents() throws Exception {
    SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
    ResourceSetImpl rs = new ResourceSetImpl();
    rs.setURIConverter(models);

    models.addModel("foo.importuritestlanguage", "import 'bar.importuritestlanguage' type Foo");
    models.addModel("bar.importuritestlanguage", "type A type B type C");

    Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);

    IScope scope = getScopeProvider().getScope(((Main)resource.getContents().get(0)).getTypes().get(0), ImportedURIPackage.Literals.TYPE__EXTENDS);
    HashSet<IEObjectDescription> set = Sets.newHashSet(scope.getAllElements());
    assertEquals(4,set.size());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号