Skip to content

Commit

Permalink
Update abstractAstView.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Danyylka authored and Aniket-Engg committed Dec 23, 2024
1 parent b7f13d6 commit 56ce755
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

type WrapFunction = ((contracts: ContractHLAst[], isSameName: boolean, version: string) => ReportObj[])

export default class abstractAstView {
export default class AbstractAstView {
contracts: ContractHLAst[] = []
currentContractIndex = -1
currentFunctionIndex = -1
Expand Down Expand Up @@ -91,7 +91,7 @@ export default class abstractAstView {
parameters: this.getLocalParameters(node)
})
} else if (node.nodeType === 'ModifierInvocation') {
if (!this.isFunctionNotModifier) throw new Error('abstractAstView.js: Found modifier invocation outside of function scope.')
if (!this.isFunctionNotModifier) throw new Error('AbstractAstView.js: Found modifier invocation outside of function scope.')
this.getCurrentFunction().modifierInvocations.push(node)
} else if (relevantNodeFilter(node)) {
let scope: FunctionHLAst | ModifierHLAst | ContractHLAst = (this.isFunctionNotModifier) ? this.getCurrentFunction() : this.getCurrentModifier()
Expand Down Expand Up @@ -130,15 +130,15 @@ export default class abstractAstView {
if (inheritsFrom) {
currentContract.stateVariables = currentContract.stateVariables.concat(inheritsFrom.stateVariables)
} else {
console.log('abstractAstView.js: could not find contract definition inherited from ' + inheritsFromName)
console.log('AbstractAstView.js: could not find contract definition inherited from ' + inheritsFromName)
}
})
}

private setCurrentContract (contract: ContractHLAst): void {
const name: string = getContractName(contract.node)
if (this.contracts.map((c: ContractHLAst) => getContractName(c.node)).filter((n) => n === name).length > 0) {
console.log('abstractAstView.js: two or more contracts with the same name detected, import aliases not supported at the moment')
console.log('AbstractAstView.js: two or more contracts with the same name detected, import aliases not supported at the moment')
this.multipleContractsWithSameName = true
}
this.currentContractIndex = (this.contracts.push(contract) - 1)
Expand Down

0 comments on commit 56ce755

Please sign in to comment.