Bug: getTableArgument does not work with PropAccessExpr
sam-goodwin opened this issue · 0 comments
sam-goodwin commented
Moving to SWC introduced a regression with ReferenceExpr - the ts-transformer used to transform expressions such as PropAccessExpr into a ReferenceExpr if the root was pointing to a free variable.
const a;
() => {
a.b; // used to be ReferenceExpr(() => a.b),
}
SWC made it so the ReferenceExpr only took the place of an Identiifer, i.e. in this case PropAccessExpr(ReferenceExpr(() => a), "b")
Upon updating the samples to SWC, the saga-function broke because getTableArgument assumes the previous behavior: https://github.com/functionless/functionless-samples/blob/main/packages/sagaFunction/src/saga-function.ts#L45
SynthError: First argument into putItem should be an input with a property 'Table' that is a Table.
https://functionless.org/docs/error-codes#expected-an-object-literal
at getTableArgument (/Users/samgoodwin/workspaces/functionless-samples/node_modules/functionless/src/aws.ts:700:8)
at Object.bind (/Users/samgoodwin/workspaces/functionless-samples/node_modules/functionless/src/aws.ts:634:23)
at /Users/samgoodwin/workspaces/functionless-samples/node_modules/functionless/src/function.ts:673:15
at Array.flatMap (<anonymous>)
at new Function (/Users/samgoodwin/workspaces/functionless-samples/node_modules/functionless/src/function.ts:670:52)
at new SagaFunction (/Users/samgoodwin/workspaces/functionless-samples/packages/sagaFunction/src/saga-function.ts:25:33)
at Object.<anonymous> (/Users/samgoodwin/workspaces/functionless-samples/packages/sagaFunction/src/app.ts:22:22)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Module._compile (/Users/samgoodwin/workspaces/functionless-samples/node_modules/pirates/lib/index.js:136:24)
at Module._extensions..js (node:internal/modules/cjs/loader:1157:10) {
code: { code: 10012, type: 'ERROR', title: 'Expected an object literal' }
}