Exemplo n.º 1
0
 @NotNull
 public static TranslationContext rootContext(@NotNull StaticContext staticContext) {
   JsProgram program = staticContext.getProgram();
   JsBlock globalBlock = program.getGlobalBlock();
   DynamicContext rootDynamicContext =
       DynamicContext.rootContext(staticContext.getRootScope(), globalBlock);
   AliasingContext rootAliasingContext = AliasingContext.getCleanContext();
   return new TranslationContext(staticContext, rootDynamicContext, rootAliasingContext);
 }
Exemplo n.º 2
0
 // TODO: consider passing a function here
 @NotNull
 public TranslationContext innerContextWithGivenScopeAndBlock(
     @NotNull JsScope scope, @NotNull JsBlock block) {
   return contextWithScope(dynamicContext.getScope().innerScope(scope), block);
 }
Exemplo n.º 3
0
 @NotNull
 public TranslationContext innerBlock(@NotNull JsBlock block) {
   return new TranslationContext(staticContext, dynamicContext.innerBlock(block), aliasingContext);
 }
Exemplo n.º 4
0
 @NotNull
 public TranslationContext contextWithScope(
     @NotNull NamingScope newScope, @NotNull JsBlock block) {
   return new TranslationContext(
       staticContext, DynamicContext.newContext(newScope, block), aliasingContext);
 }
Exemplo n.º 5
0
 public void addStatementToCurrentBlock(@NotNull JsStatement statement) {
   dynamicContext.jsBlock().getStatements().add(statement);
 }
Exemplo n.º 6
0
 @NotNull
 public JsScope jsScope() {
   return dynamicContext.jsScope();
 }
Exemplo n.º 7
0
 @NotNull
 public TemporaryVariable declareTemporary(
     @NotNull JsExpression initExpression, boolean initialize) {
   return dynamicContext.declareTemporary(initExpression, initialize);
 }
Exemplo n.º 8
0
 @NotNull
 public TemporaryVariable declareTemporary(@NotNull JsExpression initExpression) {
   return dynamicContext.declareTemporary(initExpression);
 }