@@ -59,7 +59,7 @@ class Instrumenter {
59
59
std::mt19937_64 &RNG;
60
60
ASTContext &Context;
61
61
DeclContext *TypeCheckDC;
62
- unsigned TmpNameIndex = 0 ;
62
+ unsigned & TmpNameIndex;
63
63
bool HighPerformance;
64
64
65
65
struct BracePair {
@@ -170,10 +170,11 @@ class Instrumenter {
170
170
ClosureFinder CF;
171
171
172
172
public:
173
- Instrumenter (ASTContext &C, DeclContext *DC, std::mt19937_64 &RNG,
174
- bool HP) :
175
- RNG (RNG), Context(C), TypeCheckDC(DC), HighPerformance(HP), CF(*this ) { }
176
-
173
+ Instrumenter (ASTContext &C, DeclContext *DC, std::mt19937_64 &RNG, bool HP,
174
+ unsigned &TmpNameIndex)
175
+ : RNG(RNG), Context(C), TypeCheckDC(DC), TmpNameIndex(TmpNameIndex),
176
+ HighPerformance (HP), CF(*this ) {}
177
+
177
178
Stmt *transformStmt (Stmt *S) {
178
179
switch (S->getKind ()) {
179
180
default :
@@ -1085,15 +1086,16 @@ void swift::performPlaygroundTransform(SourceFile &SF,
1085
1086
private:
1086
1087
std::mt19937_64 RNG;
1087
1088
bool HighPerformance;
1089
+ unsigned TmpNameIndex = 0 ;
1088
1090
public:
1089
- ExpressionFinder (bool HP) : HighPerformance(HP) { }
1091
+ ExpressionFinder (bool HP) : HighPerformance(HP) {}
1090
1092
1091
1093
virtual bool walkToDeclPre (Decl *D) {
1092
1094
if (AbstractFunctionDecl *FD = dyn_cast<AbstractFunctionDecl>(D)) {
1093
1095
if (!FD->isImplicit ()) {
1094
1096
if (BraceStmt *Body = FD->getBody ()) {
1095
1097
ASTContext &ctx = FD->getASTContext ();
1096
- Instrumenter I (ctx, FD, RNG, HighPerformance);
1098
+ Instrumenter I (ctx, FD, RNG, HighPerformance, TmpNameIndex );
1097
1099
BraceStmt *NewBody = I.transformBraceStmt (Body);
1098
1100
if (NewBody != Body) {
1099
1101
FD->setBody (NewBody);
@@ -1106,7 +1108,7 @@ void swift::performPlaygroundTransform(SourceFile &SF,
1106
1108
if (!TLCD->isImplicit ()) {
1107
1109
if (BraceStmt *Body = TLCD->getBody ()) {
1108
1110
ASTContext &ctx = static_cast <Decl*>(TLCD)->getASTContext ();
1109
- Instrumenter I (ctx, TLCD, RNG, HighPerformance);
1111
+ Instrumenter I (ctx, TLCD, RNG, HighPerformance, TmpNameIndex );
1110
1112
BraceStmt *NewBody = I.transformBraceStmt (Body, true );
1111
1113
if (NewBody != Body) {
1112
1114
TLCD->setBody (NewBody);
0 commit comments