diff --git a/src/app/declared-at/declared-at.component.ts b/src/app/declared-at/declared-at.component.ts index 12d3c65793db4c07d877f98f706cdac5fc2443cf..16ec099bcb8294a408ae6f3f3e87b913c9e64182 100644 --- a/src/app/declared-at/declared-at.component.ts +++ b/src/app/declared-at/declared-at.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; import {Doc} from '../doc'; @@ -8,19 +8,20 @@ import {Doc} from '../doc'; Declared at <a [routerLink]="['/source', filename, line]">{{filepath}}:{{line}}.</a> `, }) -export class DeclaredAtComponent implements OnInit { +export class DeclaredAtComponent { - @Input() doc: Doc; + private _doc: Doc; filename: string; filepath: string; line: string; constructor() { } - ngOnInit() { - this.filepath = this.doc.ragFile; - this.filename = this.filepath.replace(/\/|\\/g, '_'); - this.line = String(this.doc.line); + @Input() + set doc(doc: Doc) { + this._doc = doc; + this.filepath = doc.ragFile; + this.filename = this.filepath.replace(/\/|\\|\./g, '_'); + this.line = String(doc.line); } - } diff --git a/src/app/type-details.component.html b/src/app/type-details.component.html index 93344b769514c6fc14f085e1178c86c8930b4a55..6a8b39ed72ec065eb2cd6230862cc594cb8f411e 100644 --- a/src/app/type-details.component.html +++ b/src/app/type-details.component.html @@ -3,10 +3,13 @@ <p *ngIf="type.superclass">extends <type-ref [type]="type.superclass"></type-ref> <ng-container *ngIf="type.superinterfaces">implements <ng-container *ngFor="let iface of type.superinterfaces; let isLast = last"><type-ref [type]="iface"></type-ref><div *ngIf="!isLast" class="sep">, </div></ng-container></ng-container> </p> + <p> + <ng-container *ngIf="type.subtypes">Direct subtypes: <ng-container *ngFor="let subtype of type.subtypes; let isLast = last"><type-ref [type]="subtype"></type-ref><div *ngIf="!isLast" class="sep">, </div></ng-container></ng-container> + </p> <div *ngIf="type.doc"> <p [innerHTML]="type.doc.description"> - <p *ngIf="type.doc.astdecl">JastAdd production: {{type.doc.astdecl}} + <p *ngIf="type.doc.astdecl">JastAdd production: <b>{{type.doc.astdecl}}</b> <p *ngIf="type.doc && type.doc.ragFile"><declared-at [doc]="type.doc"></declared-at> </div> diff --git a/src/app/type.ts b/src/app/type.ts index 6ad43f65b6de3d7297ec76724b95e667c0522f79..8b7313903a081b44838220fda4e10e6e9cb0fbd5 100644 --- a/src/app/type.ts +++ b/src/app/type.ts @@ -17,6 +17,7 @@ export class Type { inherited_methods: InheritedMembers[]; inherited_attributes: InheritedMembers[]; inherited_fields: InheritedMembers[]; + subtypes: TypeRef[]; static fromJson(json: any): Type { var groups = {}; @@ -55,6 +56,10 @@ export class Type { if (json.args) { args = (json.args as any[]).map(arg => TypeRef.fromJson(arg)); } + var subtypes: TypeRef[] = undefined; + if (json.subtypes) { + subtypes = (json.subtypes as any[]).map(arg => TypeRef.fromJson(arg)); + } return Object.assign({}, json, { groups: groups, id: TypeRef.typeId(json.name, json.id), @@ -63,6 +68,7 @@ export class Type { inherited_methods: inherited_methods, inherited_attributes: inherited_attributes, inherited_fields: inherited_fields, + subtypes: subtypes, }); } }