UNPKG

868 BPlain TextView Raw
1export enum Tipos {
2 'Function',
3 'User Function',
4 'Class',
5 'Method',
6 'Static Function'
7}
8export class Fonte {
9 public fonte: string;
10 public funcoes: Funcao[];
11 constructor(fonte?: string) {
12 this.fonte = fonte;
13 this.funcoes = [];
14 }
15 public addFunction(tipo: Tipos, nome: string, linha: number) {
16 this.funcoes.push(new Funcao(tipo, nome, linha));
17 }
18 public addVariavel(variavel: string) {
19 this.funcoes[this.funcoes.length - 1].variaveisLocais.push(variavel);
20 }
21}
22export class Funcao {
23 public tipo: Tipos;
24 public nome: string;
25 public linha: number;
26 //Armazena as variáveis locais não usadas
27 public variaveisLocais: string[];
28 constructor(tipo: Tipos, nome: string, linha: number) {
29 this.tipo = tipo;
30 this.nome = nome;
31 this.linha = linha;
32 this.variaveisLocais = [];
33 }
34}