ts2famix 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ts2famix",
3
- "version": "1.0.9",
4
- "description": "Examples of the TypeScript compiler API usage",
3
+ "version": "1.0.11",
4
+ "description": "A TypeScript to JSON importer for Moose 10.",
5
5
  "main": "dist/ts2famix-cli.js",
6
6
  "scripts": {
7
7
  "dev": "ts-node src/ts2famix-cli.ts",
@@ -40,9 +40,16 @@ export class ProcessAccesses {
40
40
  */
41
41
  private processNodeForAccesses(n: Identifier, id: number): void {
42
42
  try {
43
+ // sometimes node's first ancestor is a PropertyDeclaration, which is not an access
44
+ // see https://github.com/fuhrmanator/FamixTypeScriptImporter/issues/9
45
+ // check for a node whose first ancestor is a property declaration and bail?
46
+ // This may be a bug in ts-morph?
47
+ if (n.getFirstAncestorOrThrow().getKindName() === "PropertyDeclaration") {
48
+ console.info(`processNodeForAccesses: node kind: ${n.getKindName()}, ${n.getText()}, (${n.getType().getText()}) is a PropertyDeclaration. Skipping...`);
49
+ return;
50
+ }
43
51
  this.famixFunctions.createFamixAccess(n, id);
44
-
45
- console.info(`processNodeForAccesses: node: node, (${n.getType().getText()})`);
52
+ console.info(`processNodeForAccesses: node kind: ${n.getKindName()}, ${n.getText()}, (${n.getType().getText()})`);
46
53
  } catch (error) {
47
54
  console.error(`> WARNING: got exception ${error}. ScopeDeclaration invalid for ${n.getSymbol().getFullyQualifiedName()}. Continuing...`);
48
55
  }
@@ -347,12 +347,13 @@ export class ProcessFiles {
347
347
  const fmxProperty = this.famixFunctions.createFamixProperty(p);
348
348
 
349
349
  console.info(`processProperty: property: ${p.getName()}, (${p.getType().getText()}), fqn = ${fmxProperty.getFullyQualifiedName()}`);
350
+ console.info(` ---> It's a Property${(p instanceof PropertySignature) ? "Signature" : "Declaration"}!`);
350
351
 
351
352
  this.processComments(p, fmxProperty);
352
353
 
353
354
  if (!(p instanceof PropertySignature)) {
354
355
  this.processDecorators(p, fmxProperty);
355
-
356
+ console.info(`processProperty: adding access: ${p.getName()}, (${p.getType().getText()}) Famix ${fmxProperty.getName()}`);
356
357
  this.accesses.set(fmxProperty.id, p);
357
358
  }
358
359