diff --git a/packages/core/src/utils/make-namespaced.test.ts.md b/packages/core/src/utils/make-namespaced.test.ts.md index 321a04302..926e3b73f 100644 --- a/packages/core/src/utils/make-namespaced.test.ts.md +++ b/packages/core/src/utils/make-namespaced.test.ts.md @@ -209,7 +209,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract UsesAddress {␊ - enum $astId_id_random { dummy }␊ + IDummy public constant MY_CONTRACT = IDummy(MY_ADDRESS);␊ }␊ ␊ contract HasFunctionWithRequiredReturn {␊ diff --git a/packages/core/src/utils/make-namespaced.test.ts.snap b/packages/core/src/utils/make-namespaced.test.ts.snap index 186d7df26..c805dc2f1 100644 Binary files a/packages/core/src/utils/make-namespaced.test.ts.snap and b/packages/core/src/utils/make-namespaced.test.ts.snap differ diff --git a/packages/core/src/utils/make-namespaced.ts b/packages/core/src/utils/make-namespaced.ts index 5d039ac82..009d10434 100644 --- a/packages/core/src/utils/make-namespaced.ts +++ b/packages/core/src/utils/make-namespaced.ts @@ -67,7 +67,7 @@ export function makeNamespacedInput(input: SolcInput, output: SolcOutput): SolcI } case 'VariableDeclaration': { // If variable is a constant, keep it since it may be referenced in a struct - if (isConstant(contractNode)) { + if (contractNode.constant) { break; } // Otherwise, fall through to convert to dummy enum @@ -115,7 +115,7 @@ export function makeNamespacedInput(input: SolcInput, output: SolcOutput): SolcI // We do this by converting them to dummy enums, but avoiding duplicate names. case 'VariableDeclaration': { // If variable is a constant, keep it since it may be referenced in a struct - if (isConstant(node)) { + if (node.constant) { break; } // Otherwise, fall through to convert to dummy enum @@ -163,10 +163,6 @@ interface Modification { text?: string; } -function isConstant(contractNode: VariableDeclaration) { - return contractNode.constant && contractNode.typeName?.nodeType === 'ElementaryTypeName'; -} - function toDummyEnumWithName(name: string) { return `enum ${name} { dummy }`; }