Skip to content
Snippets Groups Projects
Commit 4e8bb603 authored by Jesper's avatar Jesper
Browse files

Add direct subtypes, improve declared-at updating

parent 025202da
No related branches found
No related tags found
No related merge requests found
import { Component, OnInit, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import {Doc} from '../doc'; import {Doc} from '../doc';
...@@ -8,19 +8,20 @@ import {Doc} from '../doc'; ...@@ -8,19 +8,20 @@ import {Doc} from '../doc';
Declared at <a [routerLink]="['/source', filename, line]">{{filepath}}:{{line}}.</a> 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; filename: string;
filepath: string; filepath: string;
line: string; line: string;
constructor() { } constructor() { }
ngOnInit() { @Input()
this.filepath = this.doc.ragFile; set doc(doc: Doc) {
this.filename = this.filepath.replace(/\/|\\/g, '_'); this._doc = doc;
this.line = String(this.doc.line); this.filepath = doc.ragFile;
this.filename = this.filepath.replace(/\/|\\|\./g, '_');
this.line = String(doc.line);
} }
} }
...@@ -3,10 +3,13 @@ ...@@ -3,10 +3,13 @@
<p *ngIf="type.superclass">extends <type-ref [type]="type.superclass"></type-ref> <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> <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>
<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"> <div *ngIf="type.doc">
<p [innerHTML]="type.doc.description"> <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> <p *ngIf="type.doc && type.doc.ragFile"><declared-at [doc]="type.doc"></declared-at>
</div> </div>
......
...@@ -17,6 +17,7 @@ export class Type { ...@@ -17,6 +17,7 @@ export class Type {
inherited_methods: InheritedMembers[]; inherited_methods: InheritedMembers[];
inherited_attributes: InheritedMembers[]; inherited_attributes: InheritedMembers[];
inherited_fields: InheritedMembers[]; inherited_fields: InheritedMembers[];
subtypes: TypeRef[];
static fromJson(json: any): Type { static fromJson(json: any): Type {
var groups = {}; var groups = {};
...@@ -55,6 +56,10 @@ export class Type { ...@@ -55,6 +56,10 @@ export class Type {
if (json.args) { if (json.args) {
args = (json.args as any[]).map(arg => TypeRef.fromJson(arg)); 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, { return Object.assign({}, json, {
groups: groups, groups: groups,
id: TypeRef.typeId(json.name, json.id), id: TypeRef.typeId(json.name, json.id),
...@@ -63,6 +68,7 @@ export class Type { ...@@ -63,6 +68,7 @@ export class Type {
inherited_methods: inherited_methods, inherited_methods: inherited_methods,
inherited_attributes: inherited_attributes, inherited_attributes: inherited_attributes,
inherited_fields: inherited_fields, inherited_fields: inherited_fields,
subtypes: subtypes,
}); });
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment