@@ -1091,7 +1091,7 @@ RootObject _findAST(Dsymbol sym, const(char*) filename, int startLine, int start
10911091
10921092RootObject findAST (Module mod, int startLine, int startIndex, int endLine, int endIndex)
10931093{
1094- auto filename = mod.srcfile.toChars() ;
1094+ auto filename = mod.srcfile.toString().toLocFilename.ptr ;
10951095 return _findAST (mod, filename, startLine, startIndex, endLine, endIndex);
10961096}
10971097
@@ -1524,7 +1524,7 @@ string findTip(Module mod, int startLine, int startIndex, int endLine, int endIn
15241524 showSizeAndAlignment = addsize;
15251525 scope (exit) showSizeAndAlignment = false ; // tips also used by findExpansions
15261526
1527- auto filename = mod.srcfile.toChars() ;
1527+ auto filename = mod.srcfile.toString().toLocFilename.ptr ;
15281528 scope FindTipVisitor ftv = new FindTipVisitor(filename, startLine, startIndex, endLine, endIndex);
15291529 mod.accept(ftv);
15301530
@@ -1606,7 +1606,7 @@ extern(C++) class FindDefinitionVisitor : FindASTVisitor
16061606
16071607string findDefinition (Module mod, ref int line, ref int index)
16081608{
1609- auto filename = mod.srcfile.toChars() ;
1609+ auto filename = mod.srcfile.toString().toLocFilename.ptr ;
16101610 scope FindDefinitionVisitor fdv = new FindDefinitionVisitor(filename, line, index, line, index + 1 );
16111611 mod.accept(fdv);
16121612
@@ -1647,7 +1647,7 @@ Loc[] findBinaryIsInLocations(Module mod)
16471647 }
16481648
16491649 scope BinaryIsInVisitor biiv = new BinaryIsInVisitor;
1650- biiv.filename = mod.srcfile.toChars() ;
1650+ biiv.filename = mod.srcfile.toString().toLocFilename.ptr ;
16511651 biiv.unconditional = true ;
16521652 mod.accept(biiv);
16531653
@@ -1676,6 +1676,8 @@ FindIdentifierTypesResult findIdentifierTypes(Module mod)
16761676 extern (D )
16771677 final void addTypePos (const (char )[] ident, int type, int line, int col)
16781678 {
1679+ if (line <= 0 )
1680+ return ; // not visible
16791681 if (auto pid = ident in idTypes)
16801682 {
16811683 // merge sorted
@@ -2003,7 +2005,7 @@ FindIdentifierTypesResult findIdentifierTypes(Module mod)
20032005 }
20042006
20052007 scope IdentifierTypesVisitor itv = new IdentifierTypesVisitor;
2006- itv.filename = mod.srcfile.toChars() ;
2008+ itv.filename = mod.srcfile.toString().toLocFilename.ptr ;
20072009 mod.accept(itv);
20082010
20092011 return itv.idTypes;
@@ -2085,7 +2087,7 @@ ParameterStorageClassPos[] findParameterStorageClass(Module mod)
20852087 }
20862088
20872089 scope psv = new ParameterStorageClassVisitor;
2088- psv.filename = mod.srcfile.toChars() ;
2090+ psv.filename = mod.srcfile.toString().toLocFilename.ptr ;
20892091 mod.accept(psv);
20902092
20912093 return psv.stcPos;
@@ -2100,7 +2102,7 @@ struct Reference
21002102
21012103Reference[] findReferencesInModule (Module mod, int line, int index)
21022104{
2103- auto filename = mod.srcfile.toChars() ;
2105+ auto filename = mod.srcfile.toString().toLocFilename.ptr ;
21042106 scope FindDefinitionVisitor fdv = new FindDefinitionVisitor(filename, line, index, line, index + 1 );
21052107 mod.accept(fdv);
21062108
@@ -2118,7 +2120,7 @@ Reference[] findReferencesInModule(Module mod, int line, int index)
21182120 extern (D )
21192121 void addReference (ref const Loc loc, Identifier ident)
21202122 {
2121- if (loc.filename is filename && ident)
2123+ if (loc.filename is filename && ident && loc.linnum > 0 )
21222124 if (! references.contains(Reference(loc, ident)))
21232125 references ~= Reference(loc, ident);
21242126 }
@@ -2510,15 +2512,8 @@ extern(C++) class FindExpansionsVisitor : FindASTVisitor
25102512 override void visit (DotIdExp de)
25112513 {
25122514 if (! found && de.ident)
2513- {
25142515 if (matchDotIdentifier(de.dotloc, de.identloc, de.ident))
2515- {
2516- if (! de.type && de.resolvedTo && ! de.resolvedTo.isErrorExp())
2517- foundResolved(de.resolvedTo);
2518- else
2519- foundNode(de);
2520- }
2521- }
2516+ foundNode(de);
25222517 }
25232518
25242519 override void checkScope (ScopeDsymbol sc)
@@ -2542,7 +2537,7 @@ extern(C++) class FindExpansionsVisitor : FindASTVisitor
25422537
25432538string [] findExpansions (Module mod, int line, int index, string tok)
25442539{
2545- auto filename = mod.srcfile.toChars() ;
2540+ auto filename = mod.srcfile.toString().toLocFilename.ptr ;
25462541 scope FindExpansionsVisitor fdv = new FindExpansionsVisitor(filename, line, index, line, index + 1 );
25472542 mod.accept(fdv);
25482543
@@ -2584,6 +2579,13 @@ string[] findExpansions(Module mod, int line, int index, string tok)
25842579 if (auto t = getType(e, false ))
25852580 type = t;
25862581 }
2582+ if (! type)
2583+ if (auto sym = fdv.found ? fdv.found.isDsymbol() : null )
2584+ if (auto em = sym.isEnumMember())
2585+ type = em.ed.type;
2586+
2587+ if (type && type.isTypeEnum())
2588+ flags |= SearchOpt.localsOnly;
25872589
25882590 auto sds = fdv.foundScope;
25892591 if (type)
0 commit comments