All files / src/cds cds_determine_types.ts

95.65% Statements 22/23
33.33% Branches 2/6
100% Functions 1/1
95.65% Lines 22/23

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 231x 1x 1x 1x 1x 1x 1x 8x 8x   8x 8x 8x 23x 23x 23x 23x 23x 8x 8x 8x 1x 1x
import {AbstractType, IRegistry} from "..";
import {IStructureComponent, StructureType, VoidType} from "../abap/types/basic";
import {ParsedDataDefinition} from "../objects";
 
export class CDSDetermineTypes {
 
  public parseType(_reg: IRegistry, parsedData: ParsedDataDefinition): AbstractType {
 
    if (parsedData?.fields.length === 0) {
      return new VoidType("DDLS:todo");
    } else {
      const components: IStructureComponent[] = [];
      for (const f of parsedData?.fields || []) {
        components.push({
          name: f.name,
          type: new VoidType("DDLS:fieldname"),
        });
      }
      return new StructureType(components);
    }
  }
 
}