make it work with builtin symbols
This commit is contained in:
parent
220cb954f9
commit
68d468ca06
|
@ -266,7 +266,16 @@ final class FirstPass : ASTVisitor
|
|||
if (targ.type.type2 is null) continue;
|
||||
|
||||
auto part = targ.type.type2.typeIdentifierPart;
|
||||
if (part is null) continue;
|
||||
if (part is null)
|
||||
{
|
||||
if (targ.type.type2.builtinType == tok!"") continue;
|
||||
auto builtInName = getBuiltinTypeName(targ.type.type2.builtinType);
|
||||
auto newArg = GCAllocator.instance.make!(VariableContext.TypeInstance)();
|
||||
newArg.parent = current;
|
||||
newArg.chain ~= builtInName;
|
||||
current.args ~= newArg;
|
||||
continue;
|
||||
}
|
||||
|
||||
auto newArg = GCAllocator.instance.make!(VariableContext.TypeInstance)();
|
||||
newArg.parent = current;
|
||||
|
|
|
@ -177,18 +177,29 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
|||
auto key = part.name;
|
||||
|
||||
DSymbol* first;
|
||||
bool isBuiltin;
|
||||
foreach(i, crumb; ti.args[count].chain)
|
||||
{
|
||||
auto argName = crumb;
|
||||
if (i == 0)
|
||||
{
|
||||
|
||||
if (m)
|
||||
if (key in m)
|
||||
{
|
||||
argName = m[key].name;
|
||||
}
|
||||
|
||||
// check if that's a built in type
|
||||
// if it is, then use it and skip the type creation step
|
||||
foreach(builtin; builtinSymbols)
|
||||
{
|
||||
if (builtin.name == crumb)
|
||||
{
|
||||
first = builtin;
|
||||
isBuiltin = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto result = moduleScope.getSymbolsAtGlobalScope(istring(argName));
|
||||
if (result.length == 0)
|
||||
{
|
||||
|
@ -205,7 +216,7 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
|||
|
||||
auto ca = ti.args[count];
|
||||
if (ca.chain.length > 0)
|
||||
mapping[key] = createTypeWithTemplateArgs(first, lookup, ca, cache, moduleScope, depth, null);
|
||||
mapping[key] = isBuiltin ? first : createTypeWithTemplateArgs(first, lookup, ca, cache, moduleScope, depth, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
identifiers
|
||||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
sizeof k
|
||||
stringof k
|
||||
tupleof k
|
||||
value_key v int value_key stdin 0
|
||||
value_value v int value_value stdin 0
|
|
@ -0,0 +1,11 @@
|
|||
struct HashMap(Key, Value)
|
||||
{
|
||||
Key value_key;
|
||||
Value value_value;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto hmap = HashMap!(int, int)();
|
||||
hmap.
|
||||
}
|
|
@ -5,9 +5,6 @@ set -u
|
|||
|
||||
MODE=$1
|
||||
|
||||
|
||||
# ../../bin/dcd-client $1 file1.d --extended -c 270
|
||||
|
||||
function check () {
|
||||
echo "$1 $2"
|
||||
../../bin/dcd-client $MODE $1.d --extended -c $2 > $3.txt
|
||||
|
@ -36,8 +33,13 @@ diff actual_2_1.txt expected_2_1.txt --strip-trailing-cr
|
|||
diff actual_2_2.txt expected_2_2.txt --strip-trailing-cr
|
||||
|
||||
|
||||
#echo "test5"
|
||||
../../bin/dcd-client $1 file3.d --extended -c 144 > actual_3_1.txt
|
||||
diff actual_3_1.txt expected_3_1.txt --strip-trailing-cr
|
||||
|
||||
#echo "test c omplex"
|
||||
|
||||
|
||||
#echo "test complex"
|
||||
check complex 1121 actual_complex_1 expected_complex_1
|
||||
check complex 1162 actual_complex_2 expected_complex_2
|
||||
check complex 1205 actual_complex_3 expected_complex_3
|
||||
|
@ -46,4 +48,4 @@ check complex 1271 actual_complex_5 expected_complex_5
|
|||
check complex 1296 actual_complex_6 expected_complex_6
|
||||
check complex 1321 actual_complex_7 expected_complex_7
|
||||
check complex 1345 actual_complex_8 expected_complex_8
|
||||
|
||||
check complex 1413 actual_complex_9 expected_complex_9
|
||||
|
|
Loading…
Reference in New Issue