Esempio n. 1
0
 @Override
 public void release() {
   if (!myContexts.isEmpty()) {
     final TypeCheckingContext ctx = myContexts.removeLast();
     ctx.dispose();
   }
 }
Esempio n. 2
0
 @Override
 public void dispose() {
   for (TypeCheckingContext context : myContexts) {
     context.dispose();
   }
   myContexts.clear();
 }
Esempio n. 3
0
  @Nullable
  /*package*/ SNode getTypeOf(final SNode node) {
    ModelAccess.assertLegalRead();
    if (node == null) return null;

    if (myTypeChecker.isGenerationMode()) {
      TypeCheckingContext context =
          myTypeChecker.hasPerformanceTracer()
              ? new TargetTypecheckingContext_Tracer(node, myTypeChecker)
              : new TargetTypecheckingContext(node, myTypeChecker);
      try {
        return context.getTypeOf_generationMode(node);
      } finally {
        context.dispose();
      }
    }
    // now we are not in generation mode

    final ITypeContextOwner contextOwner = myTypecheckingContextOwner.get();
    TypeCheckingContext context = acquireTypecheckingContext(node, contextOwner);
    if (context == null) {
      return TypesUtil.createRuntimeErrorType();
    }

    try {
      return context.getTypeOf(node, myTypeChecker);
    } finally {
      releaseTypecheckingContext(node, contextOwner);
    }
  }
Esempio n. 4
0
 @Override
 public void release() {
   assert myCount > 0;
   if ((myCount -= 1) <= 0) {
     myContext.dispose();
     myContext = null;
   }
 }
Esempio n. 5
0
 @Override
 public void dispose() {
   if (myContext != null) {
     myContext.dispose();
   }
   myContext = null;
   myCount = 0;
 }