Generate typed QX bindings and add source editing tools
This commit is contained in:
@@ -724,7 +724,8 @@ const lowerDependencyPort = (
|
||||
? {
|
||||
id,
|
||||
displayName: name,
|
||||
requirement: { kind: "constructor", atomId },
|
||||
requirement: { kind: "constructor", atomId,
|
||||
...(context.valueType() ? { inputType: lowerValueType(state, context.valueType()) } : {}) },
|
||||
}
|
||||
: undefined;
|
||||
};
|
||||
@@ -1678,22 +1679,22 @@ const lowerWorkspace = (
|
||||
};
|
||||
};
|
||||
|
||||
const parseDocument = (
|
||||
export const parseDocument = (
|
||||
source: string,
|
||||
fileName: string,
|
||||
): { tree: DocumentContext; diagnostics: CapabilitySourceDiagnostic[] } => {
|
||||
): { tree: DocumentContext; tokens: CommonTokenStream; diagnostics: CapabilitySourceDiagnostic[] } => {
|
||||
const diagnostics: CapabilitySourceDiagnostic[] = [];
|
||||
const listener = new SyntaxErrorListener(fileName, diagnostics);
|
||||
const lexer = new QuixosCapabilityLexer(CharStream.fromString(source));
|
||||
lexer.removeErrorListeners();
|
||||
lexer.addErrorListener(listener);
|
||||
const parser = new QuixosCapabilityParser(
|
||||
new CommonTokenStream(lexer),
|
||||
);
|
||||
const tokens = new CommonTokenStream(lexer);
|
||||
const parser = new QuixosCapabilityParser(tokens);
|
||||
parser.removeErrorListeners();
|
||||
parser.addErrorListener(listener);
|
||||
const tree = parser.document();
|
||||
return { tree, diagnostics };
|
||||
tokens.fill();
|
||||
return { tree, tokens, diagnostics };
|
||||
};
|
||||
|
||||
const newLoweringState = (
|
||||
@@ -1945,6 +1946,11 @@ export const compileCapabilitySource = (
|
||||
}
|
||||
|
||||
const state = newLoweringState(fileName, diagnostics);
|
||||
for (const item of workspaceContext.workspaceItem()) {
|
||||
if (item.sourceImportDecl()) loweringIssue(state, item, "unresolved-source-import",
|
||||
"Local imports require the workspace repository compiler");
|
||||
}
|
||||
if (diagnostics.length) return { ok: false, diagnostics };
|
||||
const lowered = lowerWorkspace(state, workspaceContext, environment);
|
||||
if (diagnostics.length > 0) {
|
||||
return { ok: false, diagnostics };
|
||||
|
||||
Reference in New Issue
Block a user