diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 19:31:33 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 19:31:33 +0800 |
commit | 1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1 (patch) | |
tree | d87622263d20d97e87264effa5f4c0feaec41a30 /packages/sol-cov/src/ast_visitor.ts | |
parent | 2a9913b8fbcc4911593eab0ecdec3b62328e0b31 (diff) | |
download | dexon-sol-tools-1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1.tar dexon-sol-tools-1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1.tar.gz dexon-sol-tools-1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1.tar.bz2 dexon-sol-tools-1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1.tar.lz dexon-sol-tools-1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1.tar.xz dexon-sol-tools-1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1.tar.zst dexon-sol-tools-1cdfbbadaa1363ed8f5ecfca61576db70c0c1fb1.zip |
Add a HACK to detect coverage of the modifiers with no parameters
Diffstat (limited to 'packages/sol-cov/src/ast_visitor.ts')
-rw-r--r-- | packages/sol-cov/src/ast_visitor.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/sol-cov/src/ast_visitor.ts b/packages/sol-cov/src/ast_visitor.ts index 9193f6a18..701cbbc88 100644 --- a/packages/sol-cov/src/ast_visitor.ts +++ b/packages/sol-cov/src/ast_visitor.ts @@ -7,6 +7,7 @@ export interface CoverageEntriesDescription { fnMap: FnMap; branchMap: BranchMap; statementMap: StatementMap; + modifiersStatementIds: number[]; } enum BranchType { @@ -19,6 +20,7 @@ export class ASTVisitor { private _entryId = 0; private _fnMap: FnMap = {}; private _branchMap: BranchMap = {}; + private _modifiersStatementIds: number[] = []; private _statementMap: StatementMap = {}; private _locationByOffset: LocationByOffset; private static _doesLookLikeAnASTNode(ast: any): boolean { @@ -49,6 +51,7 @@ export class ASTVisitor { fnMap: this._fnMap, branchMap: this._branchMap, statementMap: this._statementMap, + modifiersStatementIds: this._modifiersStatementIds, }; return coverageEntriesDescription; } @@ -91,6 +94,7 @@ export class ASTVisitor { private _visitModifierArgument(ast: SolidityParser.AST): void { const BUILTIN_MODIFIERS = ['public', 'view', 'payable', 'external', 'internal', 'pure', 'constant']; if (!_.includes(BUILTIN_MODIFIERS, ast.name)) { + this._modifiersStatementIds.push(this._entryId); this._visitStatement(ast); } } |