use of org.graalvm.polyglot.Language in project graal by oracle.
the class PolyglotEngineImpl method createLanguage.
private PolyglotLanguage createLanguage(LanguageCache cache, int index, RuntimeException initError) {
PolyglotLanguage languageImpl = new PolyglotLanguage(this, cache, index, index == HOST_LANGUAGE_INDEX, initError);
languageImpl.info = NODES.createLanguage(languageImpl, cache.getId(), cache.getName(), cache.getVersion(), cache.getMimeTypes(), cache.isInternal());
Language language = impl.getAPIAccess().newLanguage(languageImpl);
languageImpl.api = language;
return languageImpl;
}
use of org.graalvm.polyglot.Language in project graal by oracle.
the class EngineAPITest method getLanguageMeta.
@Test
public void getLanguageMeta() {
Engine engine = Engine.create();
Language language = engine.getLanguages().get(EngineAPITestLanguage.ID);
assertNotNull(language);
assertEquals(EngineAPITestLanguage.ID, language.getId());
assertEquals(EngineAPITestLanguage.NAME, language.getName());
assertEquals(EngineAPITestLanguage.VERSION, language.getVersion());
assertEquals(EngineAPITestLanguage.IMPL_NAME, language.getImplementationName());
assertSame(language, engine.getLanguages().get(EngineAPITestLanguage.ID));
engine.close();
}
use of org.graalvm.polyglot.Language in project graal by oracle.
the class EngineAPITest method getLanguageOptions.
@Test
public void getLanguageOptions() {
Engine engine = Engine.create();
Language language = engine.getLanguages().get(EngineAPITestLanguage.ID);
OptionDescriptor descriptor1 = language.getOptions().get(EngineAPITestLanguage.Option1_NAME);
OptionDescriptor descriptor2 = language.getOptions().get(EngineAPITestLanguage.Option2_NAME);
OptionDescriptor descriptor3 = language.getOptions().get(EngineAPITestLanguage.Option3_NAME);
assertSame(EngineAPITestLanguage.Option1, descriptor1.getKey());
assertEquals(EngineAPITestLanguage.Option1_NAME, descriptor1.getName());
assertEquals(EngineAPITestLanguage.Option1_CATEGORY, descriptor1.getCategory());
assertEquals(EngineAPITestLanguage.Option1_DEPRECATED, descriptor1.isDeprecated());
assertEquals(EngineAPITestLanguage.Option1_HELP, descriptor1.getHelp());
assertSame(EngineAPITestLanguage.Option2, descriptor2.getKey());
assertEquals(EngineAPITestLanguage.Option2_NAME, descriptor2.getName());
assertEquals(EngineAPITestLanguage.Option2_CATEGORY, descriptor2.getCategory());
assertEquals(EngineAPITestLanguage.Option2_DEPRECATED, descriptor2.isDeprecated());
assertEquals(EngineAPITestLanguage.Option2_HELP, descriptor2.getHelp());
assertSame(EngineAPITestLanguage.Option3, descriptor3.getKey());
assertEquals(EngineAPITestLanguage.Option3_NAME, descriptor3.getName());
assertEquals(EngineAPITestLanguage.Option3_CATEGORY, descriptor3.getCategory());
assertEquals(EngineAPITestLanguage.Option3_DEPRECATED, descriptor3.isDeprecated());
assertEquals(EngineAPITestLanguage.Option3_HELP, descriptor3.getHelp());
engine.close();
}
Aggregations