Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

non-existent file: missing parent field in all ts nodes #77

@armano2

Description

@armano2

@uniqueiniquity
i was doing some refactoring on converter and i found one issue when you try running tests for non-existent file.

in this test scenario non of nodes has parent field filled with value, as opposed to normal run when for same sourceCode you have parent fields filled.

example test scenario:

// tests/fixtures/typescript/basics/class-with-mixin.src.ts
function M<T extends Constructor<{}>>(Base: T) {
    return class extends Base { }
}

class X extends M<any>(C) implements I { }

class C { }
interface I { }
type Constructor<T> = new (...args: any[]) => T;

will fail because of that with error

TypeError: Cannot read property 'kind' of undefined
      at Object.canContainDirective (src/node-utils.ts:5672:33)
      at convertBodyExpressionsToDirectives (src/convert.ts:18875:155)
      at convert (src/convert.ts:19401:13)
      at converter (src/convert.ts:18818:16)
      at convertChild (src/convert.ts:18835:16)
      at convert (src/convert.ts:19627:80)
      at converter (src/convert.ts:18818:16)
      at convertChild (src/convert.ts:18835:16)
      at node.statements.forEach.statement (src/convert.ts:19373:95)
          at Array.forEach (<anonymous>)

from my investigation its seems like a lot of tests will produce incorrect AST when running as non-existent file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions