Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Main Workflow

on: [push, pull_request]
on:
pull_request:
push:
branches:
- master

jobs:
run:
Expand Down
23 changes: 5 additions & 18 deletions src/analyze/stages/discover-declarations.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SourceFile } from "typescript";
import { AnalyzerVisitContext } from "../analyzer-visit-context";
import { ComponentDeclaration } from "../types/component-declaration";
import { resolveSymbolDeclarations } from "../util/ast-util";
import { analyzeComponentDeclaration } from "./analyze-declaration";

/**
Expand All @@ -12,23 +11,11 @@ import { analyzeComponentDeclaration } from "./analyze-declaration";
export function discoverDeclarations(sourceFile: SourceFile, context: AnalyzerVisitContext): ComponentDeclaration[] {
const declarations: ComponentDeclaration[] = [];

const symbol = context.checker.getSymbolAtLocation(sourceFile);
if (symbol != null) {
// Get all exports in the source file
const exports = context.checker.getExportsOfModule(symbol);

// Find all class declarations in the source file
for (const symbol of exports) {
const node = symbol.valueDeclaration;

if (node != null) {
if (context.ts.isClassDeclaration(node) /* || context.ts.isInterfaceDeclaration(node)*/) {
const nodes = resolveSymbolDeclarations(symbol);
const decl = analyzeComponentDeclaration(nodes, context);
if (decl != null) {
declarations.push(decl);
}
}
for (const statement of sourceFile.statements) {
if (context.ts.isClassDeclaration(statement) /* || context.ts.isInterfaceDeclaration(node)*/) {
const decl = analyzeComponentDeclaration([statement], context);
if (decl != null) {
declarations.push(decl);
}
}
}
Expand Down
Loading