refactor: isolate in the code the point of template instantiation
This commit is contained in:
parent
0fbcbf661e
commit
5cea71cb25
@ -404,7 +404,21 @@ export default class PocomathInstance {
|
||||
Object.defineProperty(this, name, {configurable: true, value: 'limbo'})
|
||||
const tf_imps = {}
|
||||
for (const [rawSignature, behavior] of usableEntries) {
|
||||
/* For now, replace theTemplateParam with 'any' */
|
||||
/* Check if it's an ordinary non-template signature */
|
||||
let explicit = true
|
||||
for (const type of typesOfSignature(rawSignature)) {
|
||||
if (this._templateParam(type)) { // template types need better check
|
||||
explicit = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (explicit) {
|
||||
this._addTFimplementation(
|
||||
tf_imps, rawSignature, behavior.uses, behavior.does)
|
||||
continue
|
||||
}
|
||||
/* It's a template, have to instantiate */
|
||||
/* But just for initial testing, punt and use T as synonym for 'any' */
|
||||
const signature = rawSignature.replaceAll(theTemplateParam, 'any')
|
||||
this._addTFimplementation(
|
||||
tf_imps, signature, behavior.uses, behavior.does)
|
||||
|
Loading…
Reference in New Issue
Block a user