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
Branches
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';
......@@ -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);
}
}
......@@ -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>
......
......@@ -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,
});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment