Skip to content

feat: add arrow-import runtime semantic #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2023
Merged
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
16 changes: 16 additions & 0 deletions ui/src/lib/store/runtimeSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { analyzeCode, analyzeCodeViaQuery } from "../parser";
function collectSymbolTables({ id, get }: { id: string; get: () => MyState }) {
let pods = get().pods;
let pod = pods[id];
// Collect from parent scope.
if (!pod.parent) return {};
let allSymbolTables = pods[pod.parent].children.map(({ id, type }) => {
// FIXME make this consistent, CODE, POD, DECK, SCOPE; use enums
Expand All @@ -25,6 +26,21 @@ function collectSymbolTables({ id, get }: { id: string; get: () => MyState }) {
return Object.assign({}, ...tables);
}
});
// Collect from scopes by Arrows.
const edges = get().edges;
edges.forEach(({ source, target }) => {
if (target === pod.parent) {
if (pods[source].type === "CODE") {
allSymbolTables.push(pods[target].symbolTable);
} else {
let tables = (pods[source].children || [])
.filter(({ id }) => pods[id].ispublic)
.map(({ id }) => pods[id].symbolTable);
allSymbolTables.push(Object.assign({}, ...tables));
}
}
});
// Combine the tables and return.
let res = Object.assign({}, pods[id].symbolTable, ...allSymbolTables);
return res;
}
Expand Down