Skip to content

Commit e3c3a15

Browse files
[dtemplate.d] move semanticTiargs to templatesem.d (dlang/dmd!21737)
1 parent f3b568d commit e3c3a15

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

dmd/dtemplate.d

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import dmd.optimize;
7272
import dmd.root.array;
7373
import dmd.common.outbuffer;
7474
import dmd.rootobject;
75-
import dmd.templatesem : getExpression, TemplateInstance_semanticTiargs, equalsx;
75+
import dmd.templatesem : getExpression, equalsx;
7676
import dmd.tokens;
7777
import dmd.typesem : typeSemantic, isBaseOf;
7878
import dmd.visitor;
@@ -1736,30 +1736,6 @@ extern (C++) class TemplateInstance : ScopeDsymbol
17361736
return hash;
17371737
}
17381738

1739-
/**********************************
1740-
* Run semantic on the elements of tiargs.
1741-
* Input:
1742-
* sc
1743-
* Returns:
1744-
* false if one or more arguments have errors.
1745-
* Note:
1746-
* This function is reentrant against error occurrence. If returns false,
1747-
* all elements of tiargs won't be modified.
1748-
*/
1749-
extern (D) final bool semanticTiargs(Scope* sc)
1750-
{
1751-
//printf("+TemplateInstance.semanticTiargs() %s\n", toChars());
1752-
if (semantictiargsdone)
1753-
return true;
1754-
if (TemplateInstance_semanticTiargs(loc, sc, tiargs, 0))
1755-
{
1756-
// cache the result iff semantic analysis succeeded entirely
1757-
semantictiargsdone = 1;
1758-
return true;
1759-
}
1760-
return false;
1761-
}
1762-
17631739
/*****************************************
17641740
* Determines if a TemplateInstance will need a nested
17651741
* generation of the TemplateDeclaration.

dmd/expressionsem.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ import dmd.semantic3;
8383
import dmd.sideeffect;
8484
import dmd.safe;
8585
import dmd.target;
86-
import dmd.templatesem : matchWithInstance, deduceType, matchArg, updateTempDecl;
86+
import dmd.templatesem : matchWithInstance, deduceType, matchArg, updateTempDecl, semanticTiargs;
8787
import dmd.tokens;
8888
import dmd.traits;
8989
import dmd.typesem;

dmd/templatesem.d

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,6 +3277,31 @@ extern (D) RootObject declareParameter(TemplateDeclaration td, Scope* sc, Templa
32773277
return o;
32783278
}
32793279

3280+
/**********************************
3281+
* Run semantic on the elements of `ti.tiargs`.
3282+
* Input:
3283+
* ti = template instance whose `tiargs` should have semantic done
3284+
* sc = scope
3285+
* Returns:
3286+
* false if one or more arguments have errors.
3287+
* Note:
3288+
* This function is reentrant against error occurrence. If returns false,
3289+
* all elements of tiargs won't be modified.
3290+
*/
3291+
bool semanticTiargs(TemplateInstance ti, Scope* sc)
3292+
{
3293+
//printf("+TemplateInstance.semanticTiargs() %s\n", toChars());
3294+
if (ti.semantictiargsdone)
3295+
return true;
3296+
if (TemplateInstance_semanticTiargs(ti.loc, sc, ti.tiargs, 0))
3297+
{
3298+
// cache the result iff semantic analysis succeeded entirely
3299+
ti.semantictiargsdone = 1;
3300+
return true;
3301+
}
3302+
return false;
3303+
}
3304+
32803305
/**********************************
32813306
* Run semantic of tiargs as arguments of template.
32823307
* Input:

0 commit comments

Comments
 (0)