@@ -53,32 +53,22 @@ import std.typecons : Rebindable;
53
53
*/
54
54
final class FirstPass : ASTVisitor
55
55
{
56
- alias SymbolAllocator = GCAllocator; // NOTE using First`Pass.symbolAllocator` instead fails when analyzing Phobos master
57
- alias ScopeAllocator = GCAllocator; // NOTE using `Mallocator` instead fails when analyzing Phobos master
58
-
59
56
/**
60
57
* Params:
61
58
* mod = the module to visit
62
59
* symbolFile = path to the file being converted
63
- * symbolAllocator = allocator used for the auto-complete symbols
64
- * semanticAllocator = allocator used for semantic symbols
65
60
*/
66
- this (const Module mod, istring symbolFile, RCIAllocator symbolAllocator,
67
- RCIAllocator semanticAllocator,
61
+ this (const Module mod, istring symbolFile,
68
62
ModuleCache* cache, CacheEntry* entry = null )
69
63
in
70
64
{
71
65
assert (mod);
72
- assert (! symbolAllocator.isNull);
73
- assert (! semanticAllocator.isNull);
74
66
assert (cache);
75
67
}
76
68
do
77
69
{
78
70
this .mod = mod;
79
71
this .symbolFile = symbolFile;
80
- this .symbolAllocator = symbolAllocator;
81
- this .semanticAllocator = semanticAllocator;
82
72
this .entry = entry;
83
73
this .cache = cache;
84
74
}
@@ -146,7 +136,7 @@ final class FirstPass : ASTVisitor
146
136
147
137
if (dec.functionBody ! is null )
148
138
{
149
- pushFunctionScope(dec.functionBody, semanticAllocator,
139
+ pushFunctionScope(dec.functionBody,
150
140
dec.name.index + dec.name.text.length);
151
141
scope (exit) popScope();
152
142
processParameters(currentSymbol, dec.returnType,
@@ -374,7 +364,7 @@ final class FirstPass : ASTVisitor
374
364
rootSymbol = allocateSemanticSymbol(null , CompletionKind.moduleName,
375
365
symbolFile);
376
366
currentSymbol = rootSymbol;
377
- moduleScope = GCAllocator.instance.make! Scope(0 , uint .max); // NOTE using `semanticAllocator` here fails as `Segmentation fault (core dumped)`
367
+ moduleScope = GCAllocator.instance.make! Scope(0 , uint .max);
378
368
currentScope = moduleScope;
379
369
auto objectLocation = cache.resolveImportLocation(" object" );
380
370
if (objectLocation is null )
@@ -444,7 +434,7 @@ final class FirstPass : ASTVisitor
444
434
scope (exit) structFieldNames = move(savedStructFieldNames);
445
435
scope (exit) structFieldTypes = move(savedStructFieldTypes);
446
436
447
- DSymbol* thisSymbol = SymbolAllocator .instance.make! DSymbol(THIS_SYMBOL_NAME ,
437
+ DSymbol* thisSymbol = GCAllocator .instance.make! DSymbol(THIS_SYMBOL_NAME ,
448
438
CompletionKind.variableName, currentSymbol.acSymbol);
449
439
thisSymbol.location = currentScope.startLocation;
450
440
thisSymbol.symbolFile = symbolFile;
@@ -497,7 +487,7 @@ final class FirstPass : ASTVisitor
497
487
auto s = currentScope.getSymbolsByName(ip);
498
488
if (s.length == 0 )
499
489
{
500
- currentImportSymbol = SymbolAllocator .instance.make! DSymbol(ip, kind);
490
+ currentImportSymbol = GCAllocator .instance.make! DSymbol(ip, kind);
501
491
currentScope.addSymbol(currentImportSymbol, true );
502
492
if (last)
503
493
{
@@ -514,7 +504,7 @@ final class FirstPass : ASTVisitor
514
504
auto s = currentImportSymbol.getPartsByName(ip);
515
505
if (s.length == 0 )
516
506
{
517
- auto sym = SymbolAllocator .instance.make! DSymbol(ip, kind);
507
+ auto sym = GCAllocator .instance.make! DSymbol(ip, kind);
518
508
currentImportSymbol.addChild(sym, true );
519
509
currentImportSymbol = sym;
520
510
if (last)
@@ -781,9 +771,6 @@ final class FirstPass : ASTVisitor
781
771
// / The module
782
772
SemanticSymbol* rootSymbol;
783
773
784
- // / Allocator used for symbol allocation
785
- RCIAllocator symbolAllocator;
786
-
787
774
// / Number of symbols allocated
788
775
uint symbolsAllocated;
789
776
@@ -823,7 +810,7 @@ private:
823
810
{
824
811
assert (startLocation < uint .max);
825
812
assert (endLocation < uint .max || endLocation == size_t .max);
826
- Scope* s = ScopeAllocator .instance.make! Scope(cast (uint ) startLocation, cast (uint ) endLocation);
813
+ Scope* s = GCAllocator .instance.make! Scope(cast (uint ) startLocation, cast (uint ) endLocation);
827
814
s.parent = currentScope;
828
815
currentScope.children.insert(s);
829
816
currentScope = s;
@@ -834,10 +821,9 @@ private:
834
821
currentScope = currentScope.parent;
835
822
}
836
823
837
- void pushFunctionScope (const FunctionBody functionBody,
838
- RCIAllocator semanticAllocator, size_t scopeBegin)
824
+ void pushFunctionScope (const FunctionBody functionBody, size_t scopeBegin)
839
825
{
840
- Scope* s = ScopeAllocator .instance.make! Scope(cast (uint ) scopeBegin,
826
+ Scope* s = GCAllocator .instance.make! Scope(cast (uint ) scopeBegin,
841
827
cast (uint ) functionBody.endLocation);
842
828
s.parent = currentScope;
843
829
currentScope.children.insert(s);
@@ -926,8 +912,7 @@ private:
926
912
927
913
if (functionBody ! is null )
928
914
{
929
- pushFunctionScope(functionBody, semanticAllocator,
930
- location + 4 ); // 4 == "this".length
915
+ pushFunctionScope(functionBody, location + 4 ); // 4 == "this".length
931
916
scope (exit) popScope ();
932
917
currentSymbol = symbol;
933
918
functionBody.accept(this );
@@ -951,7 +936,7 @@ private:
951
936
952
937
if (functionBody ! is null )
953
938
{
954
- pushFunctionScope(functionBody, semanticAllocator, location + 4 ); // 4 == "this".length
939
+ pushFunctionScope(functionBody, location + 4 ); // 4 == "this".length
955
940
scope (exit) popScope ();
956
941
currentSymbol = symbol;
957
942
functionBody.accept(this );
@@ -1108,17 +1093,12 @@ private:
1108
1093
1109
1094
SemanticSymbol* allocateSemanticSymbol (string name, CompletionKind kind,
1110
1095
istring symbolFile, size_t location = 0 )
1111
- in
1112
1096
{
1113
- assert (! symbolAllocator.isNull);
1114
- }
1115
- do
1116
- {
1117
- DSymbol* acSymbol = SymbolAllocator.instance.make! DSymbol(istring(name), kind);
1097
+ DSymbol* acSymbol = GCAllocator.instance.make! DSymbol(istring(name), kind);
1118
1098
acSymbol.location = location;
1119
1099
acSymbol.symbolFile = symbolFile;
1120
1100
symbolsAllocated++ ;
1121
- return SymbolAllocator .instance.make! SemanticSymbol(acSymbol); // NOTE using semanticAllocator here breaks when analysing phobos as: `Segmentation fault (core dumped)‘’
1101
+ return GCAllocator .instance.make! SemanticSymbol(acSymbol);
1122
1102
}
1123
1103
1124
1104
void addTypeToLookups (ref TypeLookups lookups,
@@ -1207,8 +1187,6 @@ private:
1207
1187
1208
1188
const Module mod;
1209
1189
1210
- RCIAllocator semanticAllocator;
1211
-
1212
1190
Rebindable! (const ExpressionNode) feExpression;
1213
1191
1214
1192
CacheEntry* entry;
0 commit comments