Skip to content

Commit

Permalink
fix: avoid hardcoding op codes
Browse files Browse the repository at this point in the history
  • Loading branch information
boblat committed Nov 7, 2024
1 parent 9e300a1 commit 3c6132d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/awst_build/eb/op-module-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import { enumerate, invariant } from '../../util'
import type { IntrinsicOpGrouping, IntrinsicOpMapping } from '../op-metadata'
import { OP_METADATA } from '../op-metadata'
import type { PType } from '../ptypes'
import { IntrinsicEnumType, IntrinsicFunctionGroupType, IntrinsicFunctionType, stringPType } from '../ptypes'
import { IntrinsicEnumType, IntrinsicFunctionGroupType, IntrinsicFunctionType, stringPType, voidPType } from '../ptypes'
import { typeRegistry } from '../type-registry'
import { FunctionBuilder, InstanceExpressionBuilder, NodeBuilder } from './index'
import { requestConstantOfType, requestExpressionOfType } from './util'

const VOID_OPS = ['itxn_begin', 'itxn_next', 'itxn_submit']

export class IntrinsicOpGroupBuilder extends NodeBuilder {
private opGrouping: IntrinsicOpGrouping
public readonly ptype: IntrinsicFunctionGroupType
Expand All @@ -35,7 +33,7 @@ export class IntrinsicOpGroupBuilder extends NodeBuilder {
}
const metaData = this.opGrouping.ops[name]

if (VOID_OPS.includes(metaData.op) || metaData.signatures.some((s) => s.argNames.length)) {
if (metaData.signatures.some((s) => s.argNames.length || s.returnType.equals(voidPType))) {
return new GroupedIntrinsicOpBuilder(sourceLocation, metaData)
}

Expand Down

0 comments on commit 3c6132d

Please sign in to comment.