@@ -3,7 +3,7 @@ module dsymbol.builtin.names;
33import dparse.lexer;
44import dsymbol.string_interning;
55
6- package istring[24 ] builtinTypeNames;
6+ package istring[25 ] builtinTypeNames;
77
88// Constants for buit-in or dummy symbol names
99
@@ -60,7 +60,7 @@ package istring[24] builtinTypeNames;
6060 */
6161@(" *" ) istring POINTER_SYMBOL_NAME ;
6262
63- /**
63+ /**
6464 * Allocated as semantic symbol & DSymbol with this name + generates a new scope.
6565 * Inserted for function literals. (e.g. delegates like `(foo) { ... }`)
6666 *
@@ -70,7 +70,7 @@ package istring[24] builtinTypeNames;
7070 * embedded inside the calltip.
7171 */
7272@(" *function-literal*" ) istring FUNCTION_LITERAL_SYMBOL_NAME ;
73- /**
73+ /**
7474 * Generated from imports, where each full module/package import is a single
7575 * semantic symbol & DSymbol. DSymbol's `skipOver` is set to true if it's not a
7676 * public import. For each identifier inside the import identifier chain a
@@ -102,7 +102,7 @@ package istring[24] builtinTypeNames;
102102 * with CompletionKind.importSymbol as child.
103103 */
104104@(" import" ) istring IMPORT_SYMBOL_NAME ;
105- /**
105+ /**
106106 * Breadcrumb type that is emitted for array literals and array initializers.
107107 *
108108 * Gets built into an array DSymbol with the element type as child type and
@@ -183,7 +183,7 @@ package istring[24] builtinTypeNames;
183183 * See_Also: $(LREF TYPEOF_END_SYMBOL_NAME)
184184 */
185185@(" typeof(" ) istring TYPEOF_SYMBOL_NAME ;
186- /**
186+ /**
187187 * This symbol always appears in pairs with TYPEOF_SYMBOL_NAME, designates the
188188 * end of the typeof expression in the breadcrumbs.
189189 */
@@ -263,7 +263,8 @@ istring getBuiltinTypeName(IdType id) nothrow @nogc @safe
263263 case tok! " cdouble" : return builtinTypeNames[21 ];
264264 case tok! " cfloat" : return builtinTypeNames[22 ];
265265 case tok! " creal" : return builtinTypeNames[23 ];
266- default : assert (false );
266+ case tok! " this" : return builtinTypeNames[24 ];
267+ default : assert (false , str(id));
267268 }
268269}
269270
@@ -297,6 +298,7 @@ static this()
297298 builtinTypeNames[21 ] = internString(" cdouble" );
298299 builtinTypeNames[22 ] = internString(" cfloat" );
299300 builtinTypeNames[23 ] = internString(" creal" );
301+ builtinTypeNames[24 ] = internString(" this" );
300302
301303 static foreach (member; __traits (allMembers , dsymbol.builtin.names))
302304 {
@@ -344,5 +346,7 @@ istring symbolNameToTypeName(istring name)
344346 return builtinTypeNames[13 ];
345347 if (name == VOID_SYMBOL_NAME )
346348 return builtinTypeNames[14 ];
349+ if (name == THIS_SYMBOL_NAME )
350+ return builtinTypeNames[24 ];
347351 return name;
348352}
0 commit comments