Skip to content

Commit

Permalink
feat: Include list of checked files during syntax check
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <gordonjsmith@gmail.com>
  • Loading branch information
GordonSmith committed May 25, 2018
1 parent 64d36be commit 4951d01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/comms/src/clienttools/eclMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,11 @@ export class Workspace {
}
}

parseMetaXML(metaXML: string): void {
parseMetaXML(metaXML: string): string[] {
const metaParser = new MetaParser();
metaParser.parse(metaXML);
this.parseSources(metaParser.sources);
return metaParser.sources.map(source => path.normalize(source.$.sourcePath));
}

resolveQualifiedID(filePath: string, qualifiedID: string, charOffset?: number): ECLScope | undefined {
Expand Down
15 changes: 11 additions & 4 deletions packages/comms/src/clienttools/eclcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ const ERROR = "error";
const WARN = "warning";

export class EclccErrors {
private _checked: string[];
private errWarn: IECLErrorWarning[] = [];
private errOther: string[] = [];

constructor(stdErr: string) {
constructor(stdErr: string, checked: string[]) {
if (stdErr && stdErr.length) {
for (const errLine of stdErr.split(os.EOL)) {
let match = /([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\): (error|warning|info) C(\d*): (.*)/.exec(errLine);
Expand All @@ -59,6 +60,11 @@ export class EclccErrors {
this.errOther.push(errLine);
}
}
this._checked = checked;
}

checked(): string[] {
return this._checked;
}

all(): IECLErrorWarning[] {
Expand Down Expand Up @@ -271,7 +277,7 @@ export class ClientTools {
return this.execFile(this.eclccPath, this.cwd, this.args(args), "eclcc", `Cannot find ${this.eclccPath}`).then((response: IExecFile): IArchive => {
return {
content: response.stdout,
err: new EclccErrors(response.stderr)
err: new EclccErrors(response.stderr, [])
};
});
}
Expand All @@ -297,10 +303,11 @@ export class ClientTools {
attachWorkspace(this.cwd),
this.execFile(this.eclccPath, this.cwd, this.args([...args, "-M", filePath]), "eclcc", `Cannot find ${this.eclccPath}`)
]).then(([metaWorkspace, execFileResponse]: [Workspace, IExecFile]) => {
let checked: string[] = [];
if (execFileResponse && execFileResponse.stdout && execFileResponse.stdout.length) {
metaWorkspace.parseMetaXML(execFileResponse.stdout);
checked = metaWorkspace.parseMetaXML(execFileResponse.stdout);
}
return new EclccErrors(execFileResponse ? execFileResponse.stderr : "");
return new EclccErrors(execFileResponse ? execFileResponse.stderr : "", checked);
});
}

Expand Down

0 comments on commit 4951d01

Please sign in to comment.