@@ -4,7 +4,7 @@ import { FunctionDefinitionAstNode, ModifierDefinitionAstNode, ParameterListAstN
4
4
WhileStatementAstNode , VariableDeclarationAstNode , ContractDefinitionAstNode , InheritanceSpecifierAstNode ,
5
5
MemberAccessAstNode , BinaryOperationAstNode , FunctionCallAstNode , ExpressionStatementAstNode , UnaryOperationAstNode ,
6
6
IdentifierAstNode , IndexAccessAstNode , BlockAstNode , AssignmentAstNode , InlineAssemblyAstNode , IfStatementAstNode } from "types"
7
- import { util } from 'remix-lib '
7
+ import { concatWithSeperator , escapeRegExp } from '../../util/helpers '
8
8
9
9
type SpecialObjDetail = {
10
10
obj : string
@@ -439,7 +439,7 @@ function getFullQualifiedFunctionCallIdent (contract: ContractDefinitionAstNode,
439
439
}
440
440
441
441
function getFullQuallyfiedFuncDefinitionIdent ( contract : ContractDefinitionAstNode , func : FunctionDefinitionAstNode , paramTypes : any [ ] ) : string {
442
- return getContractName ( contract ) + '.' + getFunctionDefinitionName ( func ) + '(' + util . concatWithSeperator ( paramTypes , ',' ) + ')'
442
+ return getContractName ( contract ) + '.' + getFunctionDefinitionName ( func ) + '(' + concatWithSeperator ( paramTypes , ',' ) + ')'
443
443
}
444
444
445
445
function getUnAssignedTopLevelBinOps ( subScope : BlockAstNode | IfStatementAstNode | WhileStatementAstNode | ForStatementAstNode ) : ExpressionStatementAstNode [ ] {
@@ -665,7 +665,7 @@ function isConstructor (node: FunctionDefinitionAstNode): boolean {
665
665
* @return {bool }
666
666
*/
667
667
function isIntDivision ( node : BinaryOperationAstNode ) : boolean {
668
- return operator ( node , exactMatch ( util . escapeRegExp ( '/' ) ) ) && typeDescription ( node . rightExpression , util . escapeRegExp ( 'int' ) )
668
+ return operator ( node , exactMatch ( escapeRegExp ( '/' ) ) ) && typeDescription ( node . rightExpression , escapeRegExp ( 'int' ) )
669
669
}
670
670
671
671
/**
@@ -863,7 +863,7 @@ function isLowLevelCall (node: MemberAccessAstNode): boolean {
863
863
*/
864
864
function isLLSend04 ( node : MemberAccessAstNode ) : boolean {
865
865
return isMemberAccess ( node ,
866
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes . SEND . type ) ) ,
866
+ exactMatch ( escapeRegExp ( lowLevelCallTypes . SEND . type ) ) ,
867
867
undefined , exactMatch ( basicTypes . ADDRESS ) , exactMatch ( lowLevelCallTypes . SEND . ident ) )
868
868
}
869
869
@@ -874,7 +874,7 @@ function isLLSend04 (node: MemberAccessAstNode): boolean {
874
874
*/
875
875
function isLLSend ( node : MemberAccessAstNode ) : boolean {
876
876
return isMemberAccess ( node ,
877
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes . SEND . type ) ) ,
877
+ exactMatch ( escapeRegExp ( lowLevelCallTypes . SEND . type ) ) ,
878
878
undefined , exactMatch ( basicTypes . PAYABLE_ADDRESS ) , exactMatch ( lowLevelCallTypes . SEND . ident ) )
879
879
}
880
880
@@ -885,10 +885,10 @@ function isLLSend (node: MemberAccessAstNode): boolean {
885
885
*/
886
886
function isLLCall ( node : MemberAccessAstNode ) : boolean {
887
887
return isMemberAccess ( node ,
888
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes . CALL . type ) ) ,
888
+ exactMatch ( escapeRegExp ( lowLevelCallTypes . CALL . type ) ) ,
889
889
undefined , exactMatch ( basicTypes . ADDRESS ) , exactMatch ( lowLevelCallTypes . CALL . ident ) ) ||
890
890
isMemberAccess ( node ,
891
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes . CALL . type ) ) ,
891
+ exactMatch ( escapeRegExp ( lowLevelCallTypes . CALL . type ) ) ,
892
892
undefined , exactMatch ( basicTypes . PAYABLE_ADDRESS ) , exactMatch ( lowLevelCallTypes . CALL . ident ) )
893
893
}
894
894
@@ -899,7 +899,7 @@ function isLLCall (node: MemberAccessAstNode): boolean {
899
899
*/
900
900
function isLLCall04 ( node : MemberAccessAstNode ) : boolean {
901
901
return isMemberAccess ( node ,
902
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes [ 'CALL-0.4' ] . type ) ) ,
902
+ exactMatch ( escapeRegExp ( lowLevelCallTypes [ 'CALL-0.4' ] . type ) ) ,
903
903
undefined , exactMatch ( basicTypes . ADDRESS ) , exactMatch ( lowLevelCallTypes [ 'CALL-0.4' ] . ident ) )
904
904
}
905
905
@@ -910,7 +910,7 @@ function isLLCall04 (node: MemberAccessAstNode): boolean {
910
910
*/
911
911
function isLLCallcode ( node : MemberAccessAstNode ) : boolean {
912
912
return isMemberAccess ( node ,
913
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes . CALLCODE . type ) ) ,
913
+ exactMatch ( escapeRegExp ( lowLevelCallTypes . CALLCODE . type ) ) ,
914
914
undefined , exactMatch ( basicTypes . ADDRESS ) , exactMatch ( lowLevelCallTypes . CALLCODE . ident ) )
915
915
}
916
916
@@ -921,7 +921,7 @@ function isLLCallcode (node: MemberAccessAstNode): boolean {
921
921
*/
922
922
function isLLDelegatecall ( node : MemberAccessAstNode ) : boolean {
923
923
return isMemberAccess ( node ,
924
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes . DELEGATECALL . type ) ) ,
924
+ exactMatch ( escapeRegExp ( lowLevelCallTypes . DELEGATECALL . type ) ) ,
925
925
undefined , matches ( basicTypes . PAYABLE_ADDRESS , basicTypes . ADDRESS ) , exactMatch ( lowLevelCallTypes . DELEGATECALL . ident ) )
926
926
}
927
927
@@ -932,7 +932,7 @@ function isLLDelegatecall (node: MemberAccessAstNode): boolean {
932
932
*/
933
933
function isLLDelegatecall04 ( node : MemberAccessAstNode ) : boolean {
934
934
return isMemberAccess ( node ,
935
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes [ 'DELEGATECALL-0.4' ] . type ) ) ,
935
+ exactMatch ( escapeRegExp ( lowLevelCallTypes [ 'DELEGATECALL-0.4' ] . type ) ) ,
936
936
undefined , matches ( basicTypes . PAYABLE_ADDRESS , basicTypes . ADDRESS ) , exactMatch ( lowLevelCallTypes [ 'DELEGATECALL-0.4' ] . ident ) )
937
937
}
938
938
@@ -943,12 +943,12 @@ function isLLDelegatecall04 (node: MemberAccessAstNode): boolean {
943
943
*/
944
944
function isTransfer ( node : MemberAccessAstNode ) : boolean {
945
945
return isMemberAccess ( node ,
946
- exactMatch ( util . escapeRegExp ( lowLevelCallTypes . TRANSFER . type ) ) ,
946
+ exactMatch ( escapeRegExp ( lowLevelCallTypes . TRANSFER . type ) ) ,
947
947
undefined , matches ( basicTypes . ADDRESS , basicTypes . PAYABLE_ADDRESS ) , exactMatch ( lowLevelCallTypes . TRANSFER . ident ) )
948
948
}
949
949
950
950
function isStringToBytesConversion ( node : FunctionCallAstNode ) : boolean {
951
- return isExplicitCast ( node , util . escapeRegExp ( 'string *' ) , util . escapeRegExp ( 'bytes' ) )
951
+ return isExplicitCast ( node , escapeRegExp ( 'string *' ) , escapeRegExp ( 'bytes' ) )
952
952
}
953
953
954
954
function isExplicitCast ( node : FunctionCallAstNode , castFromType : string , castToType : string ) : boolean {
@@ -958,7 +958,7 @@ function isExplicitCast (node: FunctionCallAstNode, castFromType: string, castTo
958
958
}
959
959
960
960
function isBytesLengthCheck ( node : MemberAccessAstNode ) : boolean {
961
- return isMemberAccess ( node , exactMatch ( util . escapeRegExp ( basicTypes . UINT ) ) , undefined , util . escapeRegExp ( 'bytes *' ) , 'length' )
961
+ return isMemberAccess ( node , exactMatch ( escapeRegExp ( basicTypes . UINT ) ) , undefined , escapeRegExp ( 'bytes *' ) , 'length' )
962
962
}
963
963
964
964
/**
@@ -985,7 +985,7 @@ function isMemberAccess (node: MemberAccessAstNode, retType: string, accessor: s
985
985
}
986
986
987
987
function isSpecialVariableAccess ( node : MemberAccessAstNode , varType : SpecialObjDetail ) : boolean {
988
- return isMemberAccess ( node , exactMatch ( util . escapeRegExp ( varType . type ) ) , varType . obj , varType . obj , varType . member )
988
+ return isMemberAccess ( node , exactMatch ( escapeRegExp ( varType . type ) ) , varType . obj , varType . obj , varType . member )
989
989
}
990
990
991
991
// #################### Node Identification Primitives
@@ -1061,11 +1061,11 @@ function findFirstSubNodeLTR (node: any, type: string): any {
1061
1061
* @return {Boolean } isPayable
1062
1062
*/
1063
1063
function buildFunctionSignature ( paramTypes : any [ ] , returnTypes : any [ ] , isPayable : boolean , additionalMods ?: any ) : string {
1064
- return 'function (' + util . concatWithSeperator ( paramTypes , ',' ) + ')' + ( ( isPayable ) ? ' payable' : '' ) + ( ( additionalMods ) ? ' ' + additionalMods : '' ) + ( ( returnTypes . length ) ? ' returns (' + util . concatWithSeperator ( returnTypes , ',' ) + ')' : '' )
1064
+ return 'function (' + concatWithSeperator ( paramTypes , ',' ) + ')' + ( ( isPayable ) ? ' payable' : '' ) + ( ( additionalMods ) ? ' ' + additionalMods : '' ) + ( ( returnTypes . length ) ? ' returns (' + concatWithSeperator ( returnTypes , ',' ) + ')' : '' )
1065
1065
}
1066
1066
1067
1067
function buildAbiSignature ( funName : string , paramTypes : any [ ] ) : string {
1068
- return funName + '(' + util . concatWithSeperator ( paramTypes , ',' ) + ')'
1068
+ return funName + '(' + concatWithSeperator ( paramTypes , ',' ) + ')'
1069
1069
}
1070
1070
1071
1071
const helpers = {
0 commit comments