Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java @ 22109:b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 26 Aug 2015 14:13:43 +0200 |
parents | cf19259edf87 |
children | c2cb9f1c8688 |
comparison
equal
deleted
inserted
replaced
22108:f84a7663966d | 22109:b5eaddcdf86a |
---|---|
232 * it. The environment has knowledge of all active languages and can exchange symbols between | 232 * it. The environment has knowledge of all active languages and can exchange symbols between |
233 * them. | 233 * them. |
234 */ | 234 */ |
235 public static final class Env { | 235 public static final class Env { |
236 private final TruffleVM vm; | 236 private final TruffleVM vm; |
237 private final TruffleLanguage<?> lang; | |
237 private final LangCtx<?> langCtx; | 238 private final LangCtx<?> langCtx; |
238 private final Reader in; | 239 private final Reader in; |
239 private final Writer err; | 240 private final Writer err; |
240 private final Writer out; | 241 private final Writer out; |
241 | 242 |
242 Env(TruffleVM vm, TruffleLanguage<?> lang, Writer out, Writer err, Reader in) { | 243 Env(TruffleVM vm, TruffleLanguage<?> lang, Writer out, Writer err, Reader in) { |
243 this.vm = vm; | 244 this.vm = vm; |
244 this.in = in; | 245 this.in = in; |
245 this.err = err; | 246 this.err = err; |
246 this.out = out; | 247 this.out = out; |
248 this.lang = lang; | |
247 this.langCtx = new LangCtx<>(lang, this); | 249 this.langCtx = new LangCtx<>(lang, this); |
248 } | 250 } |
249 | 251 |
250 /** | 252 /** |
251 * Asks the environment to go through other registered languages and find whether they | 253 * Asks the environment to go through other registered languages and find whether they |
255 * | 257 * |
256 * @param globalName the name of the symbol to search for | 258 * @param globalName the name of the symbol to search for |
257 * @return object representing the symbol or <code>null</code> | 259 * @return object representing the symbol or <code>null</code> |
258 */ | 260 */ |
259 public Object importSymbol(String globalName) { | 261 public Object importSymbol(String globalName) { |
260 return API.importSymbol(vm, langCtx.lang, globalName); | 262 return API.importSymbol(vm, lang, globalName); |
261 } | 263 } |
262 | 264 |
263 /** | 265 /** |
264 * Input associated with this {@link TruffleVM}. | 266 * Input associated with this {@link TruffleVM}. |
265 * | 267 * |