few fixes
This commit is contained in:
parent
f8332b50f8
commit
fc286977f7
|
|
@ -247,19 +247,14 @@ final class FirstPass : ASTVisitor
|
||||||
|
|
||||||
void processTypeIdentifierPart(SemanticSymbol* symbol, TypeLookup* lookup, VariableContext* ctx, VariableContext.TypeInstance* current, TypeIdentifierPart tip)
|
void processTypeIdentifierPart(SemanticSymbol* symbol, TypeLookup* lookup, VariableContext* ctx, VariableContext.TypeInstance* current, TypeIdentifierPart tip)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto newArg = GCAllocator.instance.make!(VariableContext.TypeInstance)();
|
|
||||||
newArg.parent = current;
|
|
||||||
current.args ~= newArg;
|
|
||||||
|
|
||||||
if (tip.identifierOrTemplateInstance)
|
if (tip.identifierOrTemplateInstance)
|
||||||
{
|
{
|
||||||
processIdentifierOrTemplate(symbol, lookup, ctx, newArg, tip.identifierOrTemplateInstance);
|
processIdentifierOrTemplate(symbol, lookup, ctx, current, tip.identifierOrTemplateInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tip.typeIdentifierPart)
|
if (tip.typeIdentifierPart)
|
||||||
{
|
{
|
||||||
error("i should probably handle this");
|
processTypeIdentifierPart(symbol, lookup, ctx, current, tip.typeIdentifierPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -405,6 +400,8 @@ final class FirstPass : ASTVisitor
|
||||||
|
|
||||||
lookup.ctx.root = GCAllocator.instance.make!(VariableContext.TypeInstance)();
|
lookup.ctx.root = GCAllocator.instance.make!(VariableContext.TypeInstance)();
|
||||||
processTypeIdentifierPart(symbol, lookup, &lookup.ctx, lookup.ctx.root, typeIdentifierPart);
|
processTypeIdentifierPart(symbol, lookup, &lookup.ctx, lookup.ctx.root, typeIdentifierPart);
|
||||||
|
|
||||||
|
warning("template: ", lookup.ctx.root.chain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dec.autoDeclaration !is null)
|
if (dec.autoDeclaration !is null)
|
||||||
|
|
|
||||||
|
|
@ -133,12 +133,12 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
||||||
newType.type = type.type;
|
newType.type = type.type;
|
||||||
DSymbol*[string] mapping;
|
DSymbol*[string] mapping;
|
||||||
|
|
||||||
if (m)
|
//if (m)
|
||||||
foreach(k,v; m)
|
//foreach(k,v; m)
|
||||||
{
|
//{
|
||||||
warning("store mapping: ".yellow, k, " ", v.name);
|
// warning("store mapping: ".yellow, k, " ", v.name);
|
||||||
mapping[k] = v;
|
// mapping[k] = v;
|
||||||
}
|
//}
|
||||||
|
|
||||||
int[string] mapping_index;
|
int[string] mapping_index;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
@ -161,11 +161,13 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (key in mapping)
|
if (m)
|
||||||
|
if (key in m)
|
||||||
{
|
{
|
||||||
//first = mapping[argName];
|
//first = mapping[argName];
|
||||||
//continue;
|
//continue;
|
||||||
argName = mapping[key].name;
|
argName = m[key].name;
|
||||||
|
warning("mapping found: k: ".yellow, key, " v: ", argName);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = moduleScope.getSymbolsAtGlobalScope(istring(argName));
|
auto result = moduleScope.getSymbolsAtGlobalScope(istring(argName));
|
||||||
|
|
@ -199,7 +201,7 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
||||||
|
|
||||||
auto ca = ti.args[count];
|
auto ca = ti.args[count];
|
||||||
if (ca.chain.length > 0)
|
if (ca.chain.length > 0)
|
||||||
mapping[key] = createTypeWithTemplateArgs(first, lookup, ca, cache, moduleScope, depth, mapping);
|
mapping[key] = createTypeWithTemplateArgs(first, lookup, ca, cache, moduleScope, depth, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -214,6 +216,7 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
||||||
{
|
{
|
||||||
warning(" #", count, " ", part.name);
|
warning(" #", count, " ", part.name);
|
||||||
T_names ~= part.name;
|
T_names ~= part.name;
|
||||||
|
//newType.addChild(part, false);
|
||||||
}
|
}
|
||||||
else if (part.type && part.type.kind == CompletionKind.typeTmpParam)
|
else if (part.type && part.type.kind == CompletionKind.typeTmpParam)
|
||||||
{
|
{
|
||||||
|
|
@ -243,21 +246,30 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//if (depth < 50)
|
DSymbol* part_T;
|
||||||
//if (part.type && part.kind == CompletionKind.variableName)
|
|
||||||
//foreach(partPart; part.type.opSlice())
|
if (depth < 50)
|
||||||
//{
|
if (part.type && part.kind == CompletionKind.variableName)
|
||||||
// if (partPart.kind == CompletionKind.typeTmpParam)
|
foreach(partPart; part.type.opSlice())
|
||||||
// {
|
{
|
||||||
// foreach(arg; ti.args)
|
if (partPart.kind == CompletionKind.typeTmpParam)
|
||||||
// {
|
{
|
||||||
// warning(" >", arg.chain, " ", arg.args);
|
part_T = part;
|
||||||
// }
|
foreach(arg; ti.args)
|
||||||
// warning("go agane ".blue, part.name, " ", part.type.name, " with arg: ", ti.chain," Ts: ", T_names);
|
{
|
||||||
// //resolveTemplate(part, part.type, lookup, ti, moduleScope, cache, depth, mapping);
|
warning(" > ", arg.chain);
|
||||||
// break;
|
foreach(aa; arg.args)
|
||||||
// }
|
warning(" > ", aa.chain);
|
||||||
//}
|
}
|
||||||
|
warning("go agane ".blue, part.name, " ", part.type.name, " with arg: ", ti.chain," Ts: ", T_names);
|
||||||
|
resolveTemplate(part, part.type, lookup, ti, moduleScope, cache, depth, mapping);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (partPart.type && partPart.type.kind == CompletionKind.typeTmpParam)
|
||||||
|
{
|
||||||
|
warning("here!".red," ", partPart.name," ", partPart.type.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
warning("adding untouched: ", part.name, "into: ", newType);
|
warning("adding untouched: ", part.name, "into: ", newType);
|
||||||
newType.addChild(part, false);
|
newType.addChild(part, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue