/** * Finds the language associated with given root node. * * @param root the node * @return the language of the node * @since 0.12 * @deprecated no replacement */ @SuppressWarnings({"rawtypes"}) @Deprecated protected Class<? extends TruffleLanguage> findLanguageClass(RootNode root) { return root.getLanguage(TruffleLanguage.class).getClass(); }
/** * Finds the language associated with given root node. * * @param root the node * @return the language of the node * @since 0.12 * @deprecated no replacement */ @SuppressWarnings({"rawtypes"}) @Deprecated protected Class<? extends TruffleLanguage> findLanguageClass(RootNode root) { return root.getLanguage(TruffleLanguage.class).getClass(); }
/** @since 0.8 or earlier */ @Deprecated public static void dumpNewNode(Node newNode) { if (AstJsonDumpBuilder != null) { String language = ""; RootNode root = newNode.getRootNode(); if (root != null) { TruffleLanguage<?> clazz = root.getLanguage(TruffleLanguage.class); if (clazz != null) { language = clazz.getClass().getName(); } } AstJsonDumpBuilder.append("{ \"action\": \"createNode\", \"newId\": \"" + getID(newNode) + "\", \"type\": \"" + getType(newNode) + "\", \"description\": \"" + newNode.getDescription() + "\", \"language\": \"" + language + "\"" + " },\n"); } }
/** @since 0.8 or earlier */ public static void dumpNewNode(Node newNode) { if (AstJsonDumpBuilder != null) { String language = ""; RootNode root = newNode.getRootNode(); if (root != null) { TruffleLanguage<?> clazz = root.getLanguage(TruffleLanguage.class); if (clazz != null) { language = clazz.getClass().getName(); } } AstJsonDumpBuilder.append("{ \"action\": \"createNode\", \"newId\": \"" + getID(newNode) + "\", \"type\": \"" + getType(newNode) + "\", \"description\": \"" + newNode.getDescription() + "\", \"language\": \"" + language + "\"" + " },\n"); } }
/** * Returns the current context associated with the root node {@link #getLanguage(Class) * language} and {@link Thread thread}. The current context is <code>null</code> if the root * node is associated with a <code>null</code> language. This is a short-cut for * <code>this</code>. {@link #getLanguage(Class) getLanguage(languageClass)}. * {@link TruffleLanguage#getContextReference() getContextReference()}. * {@link ContextReference#get() get()}. If invoked on the fast-path then * <code>languageClass</code> must be a compilation final value. * * @see #getLanguage(Class) * @see TruffleLanguage#getContextReference() * @since 0.27 */ public final <C, T extends TruffleLanguage<C>> C getCurrentContext(Class<T> languageClass) { if (languageInfo == null) { return null; } return getLanguage(languageClass).getContextReference().get(); }
/** * Returns the current context associated with the root node {@link #getLanguage(Class) * language} and {@link Thread thread}. The current context is <code>null</code> if the root * node is associated with a <code>null</code> language. This is a short-cut for * <code>this</code>. {@link #getLanguage(Class) getLanguage(languageClass)}. * {@link TruffleLanguage#getContextReference() getContextReference()}. * {@link ContextReference#get() get()}. If invoked on the fast-path then * <code>languageClass</code> must be a compilation final value. * * @see #getLanguage(Class) * @see TruffleLanguage#getContextReference() * @since 0.27 */ public final <C, T extends TruffleLanguage<C>> C getCurrentContext(Class<T> languageClass) { if (language == null) { return null; } return getLanguage(languageClass).getContextReference().get(); }