@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); } }
public void runTypeCheckingAction(SNode node, ITypechecking.Action r) { final ITypeContextOwner contextOwner = myTypecheckingContextOwner.get(); TypeCheckingContext context = acquireTypecheckingContext(node, contextOwner); try { r.run(context); } finally { releaseTypecheckingContext(node, contextOwner); } }
public <T> T runTypeCheckingComputation( @NotNull final ITypeContextOwner contextOwner, SNode node, Computation<T> r) { final ITypeContextOwner savedOwner = myTypecheckingContextOwner.get(); myTypecheckingContextOwner.set(contextOwner); final SubtypingCache savedSubtypingCache = mySubtypingCache.get(); mySubtypingCache.set(null); TypeCheckingContext context = acquireTypecheckingContext(node, contextOwner); try { return r.compute(context); } finally { releaseTypecheckingContext(node, contextOwner); myTypecheckingContextOwner.set(savedOwner); mySubtypingCache.set(savedSubtypingCache); } }
public void runTypeCheckingAction( @NotNull final ITypeContextOwner contextOwner, SNode node, ITypechecking.Action r) { final ITypeContextOwner savedOwner = myTypecheckingContextOwner.get(); myTypecheckingContextOwner.set(contextOwner); final SubtypingCache savedSubtypingCache = mySubtypingCache.get(); mySubtypingCache.set(null); TypeCheckingContext context = acquireTypecheckingContext(node, contextOwner); try { r.run(context); } finally { releaseTypecheckingContext(node, contextOwner); myTypecheckingContextOwner.set(savedOwner); mySubtypingCache.set(savedSubtypingCache); } }