File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## 0.3.23 (2023-05-04)
4
+
5
+ - Switch AST resolver to faster implementation.
6
+ - Consider unsafe-allow at contract level.
7
+
3
8
## 0.3.22 (2023-04-26)
4
9
5
10
- Add ` -W ` option to skip ` WithInit ` generation.
Original file line number Diff line number Diff line change 1
1
import { ContractDefinition } from 'solidity-ast' ;
2
2
import { Node } from 'solidity-ast/node' ;
3
+ import { ASTResolver } from '../ast-resolver' ;
3
4
import { getConstructor } from '../solc/ast-utils' ;
4
5
import { execall } from '../utils/execall' ;
5
6
@@ -17,11 +18,22 @@ const errorKinds = [
17
18
18
19
type ValidationErrorKind = ( typeof errorKinds ) [ number ] ;
19
20
20
- export function hasOverride ( node : Node , override : ValidationErrorKind ) : boolean {
21
- return getOverrides ( node ) . includes ( override ) ;
21
+ export function hasOverride ( node : Node , override : ValidationErrorKind , resolver : ASTResolver ) : boolean {
22
+ return getOverrides ( node , resolver ) . includes ( override ) ;
22
23
}
23
24
24
- export function getOverrides ( node : Node ) : ValidationErrorKind [ ] {
25
+ export function getOverrides ( node : Node , resolver : ASTResolver ) : ValidationErrorKind [ ] {
26
+ const overrides = getOwnOverrides ( node ) ;
27
+ if ( 'scope' in node ) {
28
+ const contract = resolver . resolveContract ( node . scope ) ;
29
+ if ( contract ) {
30
+ overrides . push ( ...getOwnOverrides ( contract ) ) ;
31
+ }
32
+ }
33
+ return overrides ;
34
+ }
35
+
36
+ function getOwnOverrides ( node : Node ) : ValidationErrorKind [ ] {
25
37
if ( 'documentation' in node ) {
26
38
const doc =
27
39
typeof node . documentation === 'string' ? node . documentation : node . documentation ?. text ?? '' ;
You can’t perform that action at this time.
0 commit comments