From d62ad79232c398409352b9850a771f310a532295 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 25 Jul 2013 14:29:37 +0400 Subject: [PATCH] Create thread-safe traces --- .../jet/lang/resolve/lazy/ResolveSessionUtils.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSessionUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSessionUtils.java index ab1ea11c10e..1f7cd18c19b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSessionUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSessionUtils.java @@ -116,10 +116,7 @@ public class ResolveSessionUtils { } } - public static @NotNull BindingContext resolveToElement( - @NotNull ResolveSession resolveSession, - @NotNull JetElement jetElement - ) { + public static @NotNull BindingContext resolveToElement(@NotNull ResolveSession resolveSession, @NotNull JetElement jetElement) { @SuppressWarnings("unchecked") PsiElement resolveElement = JetPsiUtil.getTopmostParentOfTypes(jetElement, JetNamedFunction.class, JetClassInitializer.class, @@ -130,7 +127,8 @@ public class ResolveSessionUtils { if (resolveElement != null) { // All additional resolve should be done to separate trace - BindingTrace trace = new DelegatingBindingTrace(resolveSession.getBindingContext(), "trace to resolve element", jetElement); + BindingTrace trace = resolveSession.getStorageManager().createSafeTrace( + new DelegatingBindingTrace(resolveSession.getBindingContext(), "trace to resolve element", jetElement)); JetFile file = (JetFile) jetElement.getContainingFile(); @@ -338,8 +336,8 @@ public class ResolveSessionUtils { } public static JetScope getExpressionMemberScope(@NotNull ResolveSession resolveSession, @NotNull JetExpression expression) { - BindingTrace trace = new DelegatingBindingTrace( - resolveSession.getBindingContext(), "trace to resolve a member scope of expression", expression); + BindingTrace trace = resolveSession.getStorageManager().createSafeTrace(new DelegatingBindingTrace( + resolveSession.getBindingContext(), "trace to resolve a member scope of expression", expression)); if (BindingContextUtils.isExpressionWithValidReference(expression, resolveSession.getBindingContext())) { QualifiedExpressionResolver qualifiedExpressionResolver = resolveSession.getInjector().getQualifiedExpressionResolver();