Skip to content

Commit

Permalink
wip: working impl
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-0acf4 committed Dec 10, 2024
1 parent 2ea7a48 commit 56829e9
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 151 deletions.
46 changes: 24 additions & 22 deletions src/typegate/src/engine/planner/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,30 +507,32 @@ export class Planner {
stages.push(stage);

this.policiesBuilder.push(stage.id(), node.typeIdx, collected.policies);
const types = this.policiesBuilder.setReferencedTypes(
stage.id(),
node.typeIdx,
outputIdx,
inputIdx,
);

// nested quantifiers
let wrappedTypeIdx = outputIdx;
let wrappedType = this.tg.type(wrappedTypeIdx);
while (isQuantifier(wrappedType)) {
wrappedTypeIdx = getWrappedType(wrappedType);
wrappedType = this.tg.type(wrappedTypeIdx);
types.push(wrappedTypeIdx);
{
const types = this.policiesBuilder.setReferencedTypes(
stage.id(),
node.typeIdx,
outputIdx,
inputIdx,
);

// nested quantifiers
let wrappedTypeIdx = outputIdx;
let wrappedType = this.tg.type(wrappedTypeIdx);
while (isQuantifier(wrappedType)) {
wrappedTypeIdx = getWrappedType(wrappedType);
wrappedType = this.tg.type(wrappedTypeIdx);
types.push(wrappedTypeIdx);
}

stages.push(
...this.traverse(
{ ...node, typeIdx: wrappedTypeIdx, parentStage: stage },
stage,
),
);
}

stages.push(
...this.traverse(
{ ...node, typeIdx: wrappedTypeIdx, parentStage: stage },
stage,
),
);

this.policiesBuilder.pop(stage.id());

return stages;
}

Expand Down
Loading

0 comments on commit 56829e9

Please sign in to comment.