fix tests
This commit is contained in:
parent
516dff5f36
commit
a70482fddd
|
|
@ -432,16 +432,6 @@ final class FirstPass : ASTVisitor
|
||||||
structFieldTypes.insert(null);
|
structFieldTypes.insert(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// for auto declaration, we'll properly traverse the initializer
|
|
||||||
// and set the proper crumbs instead of using just the first one
|
|
||||||
// so we can handle things like cast/templates
|
|
||||||
auto lookup = symbol.typeLookups.front;
|
|
||||||
istring[] copy;
|
|
||||||
foreach(crumb; lookup.breadcrumbs[])
|
|
||||||
copy ~= crumb;
|
|
||||||
lookup.breadcrumbs.clear();
|
|
||||||
|
|
||||||
auto initializer = part.initializer.nonVoidInitializer;
|
auto initializer = part.initializer.nonVoidInitializer;
|
||||||
if (initializer && initializer.assignExpression)
|
if (initializer && initializer.assignExpression)
|
||||||
{
|
{
|
||||||
|
|
@ -451,6 +441,8 @@ final class FirstPass : ASTVisitor
|
||||||
if (CastExpression castExpression = unary.castExpression)
|
if (CastExpression castExpression = unary.castExpression)
|
||||||
{
|
{
|
||||||
warning("cast expression");
|
warning("cast expression");
|
||||||
|
auto lookup = symbol.typeLookups.front;
|
||||||
|
lookup.breadcrumbs.clear();
|
||||||
if (castExpression.type && castExpression.type.type2)
|
if (castExpression.type && castExpression.type.type2)
|
||||||
{
|
{
|
||||||
Type2 t2 = castExpression.type.type2;
|
Type2 t2 = castExpression.type.type2;
|
||||||
|
|
@ -459,6 +451,7 @@ final class FirstPass : ASTVisitor
|
||||||
buildChain(symbol, lookup, &lookup.ctx, t2.typeIdentifierPart);
|
buildChain(symbol, lookup, &lookup.ctx, t2.typeIdentifierPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (FunctionCallExpression fc = unary.functionCallExpression)
|
else if (FunctionCallExpression fc = unary.functionCallExpression)
|
||||||
{
|
{
|
||||||
|
|
@ -469,8 +462,18 @@ final class FirstPass : ASTVisitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unary)
|
if (unary
|
||||||
|
&& !unary.primaryExpression
|
||||||
|
&& !unary.indexExpression
|
||||||
|
&& !unary.throwExpression
|
||||||
|
&& !unary.assertExpression
|
||||||
|
&& !unary.argumentList
|
||||||
|
&& !unary.deleteExpression
|
||||||
|
&& !unary.newExpression
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
auto lookup = symbol.typeLookups.front;
|
||||||
|
lookup.breadcrumbs.clear();
|
||||||
// build chain
|
// build chain
|
||||||
traverseUnaryExpression(symbol, lookup, &lookup.ctx, unary);
|
traverseUnaryExpression(symbol, lookup, &lookup.ctx, unary);
|
||||||
// needs to be reversed because it got added in order (right->left)
|
// needs to be reversed because it got added in order (right->left)
|
||||||
|
|
@ -509,14 +512,17 @@ final class FirstPass : ASTVisitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol.acSymbol.name == "it")
|
if (symbol.acSymbol.name == "b")
|
||||||
{
|
{
|
||||||
import core.stdc.stdlib: exit;
|
import core.stdc.stdlib: exit;
|
||||||
|
auto lookup = symbol.typeLookups.front;
|
||||||
warning("crumb: ", lookup.breadcrumbs[]);
|
warning("crumb: ", lookup.breadcrumbs[]);
|
||||||
|
if (lookup.ctx.root)
|
||||||
warning("root: ", lookup.ctx.root.chain);
|
{
|
||||||
foreach(arg; lookup.ctx.root.args)
|
warning("root: ", lookup.ctx.root.chain);
|
||||||
warning(" arg: ", arg.chain);
|
foreach(arg; lookup.ctx.root.args)
|
||||||
|
warning(" arg: ", arg.chain);
|
||||||
|
}
|
||||||
//exit(0);
|
//exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,14 @@ void secondPass(SemanticSymbol* currentSymbol, Scope* moduleScope, ref ModuleCac
|
||||||
{
|
{
|
||||||
DSymbol*[string] mapping;
|
DSymbol*[string] mapping;
|
||||||
int depth;
|
int depth;
|
||||||
resolveTemplate(currentSymbol.acSymbol, type, lookup, lookup.ctx.root, moduleScope, cache, depth, mapping);
|
try
|
||||||
|
{
|
||||||
|
resolveTemplate(currentSymbol.acSymbol, type, lookup, lookup.ctx.root, moduleScope, cache, depth, mapping);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
warning("exception: ".red, currentSymbol.acSymbol.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -243,7 +250,7 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC
|
||||||
if (type.kind == CompletionKind.functionName)
|
if (type.kind == CompletionKind.functionName)
|
||||||
{
|
{
|
||||||
auto callTip = type.callTip;
|
auto callTip = type.callTip;
|
||||||
if (callTip.length > 1)
|
if (callTip && callTip.length > 1)
|
||||||
{
|
{
|
||||||
auto retType = extractReturnType(callTip);
|
auto retType = extractReturnType(callTip);
|
||||||
if (retType in mapping)
|
if (retType in mapping)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue