All files RoutineSymbol.ts

86.2% Statements 25/29
100% Branches 1/1
33.33% Functions 1/3
86.2% Lines 25/29

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 301x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 20865x 20865x 20865x 1x 1x     1x 1x     1x  
/*
 * This file is released under the MIT license.
 * Copyright (c) 2023, Mike Lischke
 *
 * See LICENSE file for more info.
 */
 
import { ParameterSymbol } from "./ParameterSymbol";
import { ScopedSymbol } from "./ScopedSymbol";
import { VariableSymbol } from "./VariableSymbol";
import { Type } from "./types";
 
/** A standalone function/procedure/rule. */
export class RoutineSymbol extends ScopedSymbol {
    public returnType?: Type; // Can be null if result is void.
 
    public constructor(name: string, returnType: Type) {
        super(name);
        this.returnType = returnType;
    }
 
    public getVariables(localOnly = true): Promise<VariableSymbol[]> {
        return this.getSymbolsOfType(VariableSymbol);
    }
 
    public getParameters(localOnly = true): Promise<ParameterSymbol[]> {
        return this.getSymbolsOfType(ParameterSymbol);
    }
}