This commit is contained in:
Brian Terlson 2021-03-01 11:37:36 -08:00 коммит произвёл GitHub
Родитель 02141ec9ba
Коммит 4c67999669
2 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -385,15 +385,14 @@ export function createChecker(program: Program) {
}
}
const type: ModelType = createType({
return createType({
kind: 'Model',
name: node.kind === SyntaxKind.ModelStatement ? node.id.sv : '',
node: node,
properties,
baseModels: baseModels
});
return type;
} else {
// model =
// this will likely have to change, as right now `model =` is really just
@ -416,9 +415,14 @@ export function createChecker(program: Program) {
}
function checkClassHeritage(heritage: ReferenceExpression[]): ModelType[] {
return heritage.map(heritageRef => {
return heritage.flatMap(heritageRef => {
const heritageType = getTypeForNode(heritageRef);
if (heritageType.kind === "TemplateParameter") {
// don't need to track heritage for template parameters.
return [];
}
if (heritageType.kind !== "Model") {
throwDiagnostic("Models must extend other models.", heritageRef);
}

Просмотреть файл

@ -689,6 +689,7 @@ export function visitChildren<T>(node: Types.Node, cb: NodeCb<T>): T | undefined
return visitEach(cb, node.decorators) ||
visitNode(cb, node.id) ||
visitEach(cb, node.templateParameters) ||
visitEach(cb, node.heritage) ||
visitNode(cb, node.assignment) ||
visitEach(cb, node.properties);
case Types.SyntaxKind.NamedImport: