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