Save progress
This commit is contained in:
parent
76bba560e0
commit
0088c05a2f
|
|
@ -39,6 +39,7 @@ import std.experimental.allocator.gc_allocator : GCAllocator;
|
|||
import std.experimental.logger;
|
||||
import std.meta : AliasSeq;
|
||||
import std.typecons : Rebindable;
|
||||
import std.stdio;
|
||||
|
||||
/**
|
||||
* First Pass handles the following:
|
||||
|
|
@ -341,10 +342,6 @@ final class FirstPass : ASTVisitor
|
|||
|
||||
void buildChainTemplateOrIdentifier(SemanticSymbol* symbol, TypeLookup* lookup, VariableContext* ctx, IdentifierOrTemplateInstance iot)
|
||||
{
|
||||
auto crumb = iot.identifier;
|
||||
if (crumb != tok!"")
|
||||
lookup.breadcrumbs.insert(istring(crumb.text));
|
||||
|
||||
if (iot.templateInstance)
|
||||
{
|
||||
if (iot.templateInstance.identifier != tok!"")
|
||||
|
|
@ -364,6 +361,11 @@ final class FirstPass : ASTVisitor
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto crumb = iot.identifier;
|
||||
lookup.breadcrumbs.insert(istring(crumb.text));
|
||||
}
|
||||
}
|
||||
|
||||
string buildCalltip(const(Token)[] tokens)
|
||||
|
|
@ -536,6 +538,12 @@ final class FirstPass : ASTVisitor
|
|||
|
||||
auto lookup = symbol.typeLookups.front;
|
||||
|
||||
istring[] original;
|
||||
foreach(c; lookup.breadcrumbs[])
|
||||
original ~= c;
|
||||
writeln("## var: ", symbol.acSymbol.name);
|
||||
writeln("## lookup breadcrumbs: ", lookup.breadcrumbs[]);
|
||||
|
||||
auto initializer = part.initializer.nonVoidInitializer;
|
||||
if (initializer && initializer.assignExpression)
|
||||
{
|
||||
|
|
@ -567,6 +575,7 @@ final class FirstPass : ASTVisitor
|
|||
foreach(c; *crumbs)
|
||||
result ~= c;
|
||||
|
||||
writeln("## result: ", result);
|
||||
crumbs.clear();
|
||||
foreach_reverse(c; result)
|
||||
lookup.breadcrumbs.insert(c);
|
||||
|
|
@ -579,6 +588,19 @@ final class FirstPass : ASTVisitor
|
|||
lookup.ctx.root = GCAllocator.instance.make!(VariableContext.TypeInstance)();
|
||||
processTemplateInstance(symbol, lookup, &lookup.ctx, lookup.ctx.root, iot.templateInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeln("something else2; ", iot.identifier.text, " original: ", original);
|
||||
|
||||
if (original.length > 0 && original[$-1] == "*arr*")
|
||||
{
|
||||
lookup.breadcrumbs.clear();
|
||||
foreach(c; original)
|
||||
lookup.breadcrumbs.insert(c);
|
||||
foreach_reverse(c; result)
|
||||
lookup.breadcrumbs.insert(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (PrimaryExpression pe = unary.primaryExpression)
|
||||
{
|
||||
|
|
@ -589,7 +611,19 @@ final class FirstPass : ASTVisitor
|
|||
lookup.ctx.root = GCAllocator.instance.make!(VariableContext.TypeInstance)();
|
||||
processTemplateInstance(symbol, lookup, &lookup.ctx, lookup.ctx.root, pe.identifierOrTemplateInstance.templateInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeln("something else2; ", pe.identifierOrTemplateInstance.identifier.text);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writeln("something else other");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writeln("something else final");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void secondPass(SemanticSymbol* currentSymbol, Scope* moduleScope, ref ModuleCac
|
|||
{
|
||||
foreach(lookup; currentSymbol.typeLookups[]) {
|
||||
|
||||
writeln("lookup: ", lookup.breadcrumbs[]);
|
||||
writeln("lookup: ", lookup.breadcrumbs[], " ctx: ", lookup.ctx.root);
|
||||
if (lookup.ctx.root)
|
||||
{
|
||||
auto type = currentSymbol.acSymbol.type;
|
||||
|
|
@ -179,6 +179,7 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
|||
newType.name = type.name;
|
||||
|
||||
writeln(" >>", type.name, " > ", newType.name, " ::", ti );
|
||||
writeln(" >> ct: ", ti.calltip);
|
||||
writeln(" >> args: ", ti.args);
|
||||
|
||||
newType.kind = type.kind;
|
||||
|
|
@ -593,6 +594,9 @@ void resolveTypeFromInitializer(DSymbol* symbol, TypeLookup* lookup,
|
|||
size_t i = 0;
|
||||
|
||||
auto crumbs = lookup.breadcrumbs[];
|
||||
|
||||
writeln(">> crumbs: ", crumbs);
|
||||
writeln(">> name: ", symbol.name);
|
||||
foreach (crumb; crumbs)
|
||||
{
|
||||
if (i == 0)
|
||||
|
|
@ -601,7 +605,10 @@ void resolveTypeFromInitializer(DSymbol* symbol, TypeLookup* lookup,
|
|||
symbolNameToTypeName(crumb), symbol.location);
|
||||
|
||||
if (currentSymbol is null)
|
||||
{
|
||||
writeln("return 0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (crumb == ARRAY_LITERAL_SYMBOL_NAME)
|
||||
{
|
||||
|
|
@ -613,7 +620,10 @@ void resolveTypeFromInitializer(DSymbol* symbol, TypeLookup* lookup,
|
|||
{
|
||||
typeSwap(currentSymbol);
|
||||
if (currentSymbol is null)
|
||||
{
|
||||
writeln("return");
|
||||
return;
|
||||
}
|
||||
|
||||
// Index expressions can be on a pointer, an array or an AA
|
||||
if (currentSymbol.qualifier == SymbolQualifier.array
|
||||
|
|
@ -622,9 +632,15 @@ void resolveTypeFromInitializer(DSymbol* symbol, TypeLookup* lookup,
|
|||
|| currentSymbol.kind == CompletionKind.aliasName)
|
||||
{
|
||||
if (currentSymbol.type !is null)
|
||||
{
|
||||
writeln("here! ", currentSymbol.type.name);
|
||||
currentSymbol = currentSymbol.type;
|
||||
}
|
||||
else
|
||||
{
|
||||
writeln("nope!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -632,7 +648,11 @@ void resolveTypeFromInitializer(DSymbol* symbol, TypeLookup* lookup,
|
|||
if (opIndex !is null)
|
||||
currentSymbol = opIndex.type;
|
||||
else
|
||||
return;
|
||||
{
|
||||
writeln("return weird");
|
||||
writeln("s: ", currentSymbol.name, " ", currentSymbol.qualifier);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (crumb == "foreach")
|
||||
|
|
@ -661,18 +681,28 @@ void resolveTypeFromInitializer(DSymbol* symbol, TypeLookup* lookup,
|
|||
}
|
||||
else
|
||||
{
|
||||
writeln("here");
|
||||
typeSwap(currentSymbol);
|
||||
if (currentSymbol is null)
|
||||
{
|
||||
|
||||
writeln("return", i);
|
||||
return;
|
||||
}
|
||||
currentSymbol = currentSymbol.getFirstPartNamed(crumb);
|
||||
}
|
||||
++i;
|
||||
if (currentSymbol is null)
|
||||
{
|
||||
writeln("return end", i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
typeSwap(currentSymbol);
|
||||
symbol.type = currentSymbol;
|
||||
symbol.ownType = false;
|
||||
|
||||
writeln(">> type: ", currentSymbol.name);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ identifiers
|
|||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
one_t v One one_t stdin 103 One
|
||||
one_t v One!T one_t stdin 103 One!T
|
||||
sizeof k
|
||||
stringof k
|
||||
tupleof k
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ identifiers
|
|||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
one_t v One one_t stdin 103 One
|
||||
one_t v One!T one_t stdin 103 One!T
|
||||
sizeof k
|
||||
stringof k
|
||||
tupleof k
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct Two(T, U)
|
|||
|
||||
void main()
|
||||
{
|
||||
auto from_auto_one = One!A();
|
||||
auto from_auto_one = One!(A)();
|
||||
auto from_auto_two = Two!(A, B)();
|
||||
{
|
||||
from_auto_one.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ set -u
|
|||
MODE=$1
|
||||
|
||||
function check () {
|
||||
echo "$1 $2"
|
||||
../../bin/dcd-client $MODE $1.d --extended -c $2 > $3.txt
|
||||
echo ":: :: check: $1 $2 $3"
|
||||
../../bin/dcd-client.exe $MODE $1.d --extended -c $2 > $3.txt
|
||||
diff $3.txt $4.txt --strip-trailing-cr
|
||||
}
|
||||
|
||||
|
|
@ -17,11 +17,11 @@ check file4 165 actual_extra_1 expected_extra_1
|
|||
|
||||
|
||||
#echo "test1"
|
||||
check file1 280 actual_1_1 expected_1_1
|
||||
check file1 282 actual_1_1 expected_1_1
|
||||
|
||||
|
||||
#echo "test2"
|
||||
check file1 315 actual_1_2 expected_1_2
|
||||
check file1 317 actual_1_2 expected_1_2
|
||||
|
||||
|
||||
#echo "test3"
|
||||
|
|
|
|||
Loading…
Reference in New Issue