This commit is contained in:
Mark Probst 2018-04-19 09:19:48 -07:00
Родитель 919da6625e
Коммит 0be080f869
5 изменённых файлов: 11 добавлений и 1 удалений

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

@ -73,6 +73,7 @@ export function getAccessorName(
export const unionIdentifierTypeAttributeKind = new TypeAttributeKind<Set<number>>(
"unionIdentifier",
true,
(a, b) => a.union(b),
_ => undefined,
undefined
@ -88,6 +89,7 @@ export function makeUnionIdentifierAttribute(): TypeAttributes {
export const unionMemberNamesTypeAttributeKind = new TypeAttributeKind<Map<number, AccessorEntry>>(
"unionMemberNames",
true,
(a, b) => a.merge(b),
_ => undefined,
undefined

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

@ -46,21 +46,24 @@ function splitDescription(descriptions: OrderedSet<string> | undefined): string[
export type ForbiddenWordsInfo = { names: (Name | string)[]; includeGlobalForbidden: boolean };
const assignedNameAttributeKind = new TypeAttributeKind<Name>("assignedName", undefined, undefined, undefined);
const assignedNameAttributeKind = new TypeAttributeKind<Name>("assignedName", false, undefined, undefined, undefined);
const assignedPropertyNamesAttributeKind = new TypeAttributeKind<Map<string, Name>>(
"assignedPropertyNames",
false,
undefined,
undefined,
undefined
);
const assignedMemberNamesAttributeKind = new TypeAttributeKind<Map<Type, Name>>(
"assignedMemberNames",
false,
undefined,
undefined,
undefined
);
const assignedCaseNamesAttributeKind = new TypeAttributeKind<Map<string, Name>>(
"assignedCaseNames",
false,
undefined,
undefined,
undefined

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

@ -10,6 +10,7 @@ export class TypeAttributeKind<T> {
constructor(
readonly name: string,
readonly inIdentity: boolean,
combine: ((a: T, b: T) => T) | undefined,
makeInferred: ((a: T) => T | undefined) | undefined,
stringify: ((a: T) => string | undefined) | undefined
@ -106,6 +107,7 @@ export function makeTypeAttributesInferred(attr: TypeAttributes): TypeAttributes
export const descriptionTypeAttributeKind = new TypeAttributeKind<OrderedSet<string>>(
"description",
false,
setUnion,
_ => OrderedSet(),
descriptions => {
@ -122,6 +124,7 @@ export const descriptionTypeAttributeKind = new TypeAttributeKind<OrderedSet<str
);
export const propertyDescriptionsTypeAttributeKind = new TypeAttributeKind<Map<string, OrderedSet<string>>>(
"propertyDescriptions",
false,
(a, b) => a.mergeWith(setUnion, b),
_ => Map(),
undefined

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

@ -66,6 +66,7 @@ function provenanceToString(p: Set<TypeRef>): string {
// non-inferred form in the final graph.
export const provenanceTypeAttributeKind = new TypeAttributeKind<Set<TypeRef>>(
"provenance",
false,
setUnion,
a => a,
provenanceToString

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

@ -237,6 +237,7 @@ export function typeNamesUnion(c: Collection<any, TypeNames>): TypeNames {
export const namesTypeAttributeKind = new TypeAttributeKind<TypeNames>(
"names",
false,
(a, b) => a.add(b),
a => a.makeInferred(),
a => a.toString()