@@ -23,6 +23,10 @@ class SolidityAnnotator : Annotator {
23
23
when (element) {
24
24
is SolNumberType -> applyColor(holder, element, SolColor .TYPE )
25
25
is SolElementaryTypeName -> applyColor(holder, element, SolColor .TYPE )
26
+ is SolStateMutability -> if (element.text == " payable" ) {
27
+ applyColor(holder, element, SolColor .KEYWORD )
28
+ }
29
+ is SolEnumValue -> applyColor(holder, element, SolColor .ENUM_VALUE )
26
30
is SolMemberAccessExpression -> when (element.expression.firstChild.text) {
27
31
" super" -> applyColor(holder, element.expression.firstChild, SolColor .KEYWORD )
28
32
" msg" , " block" , " abi" -> applyColor(holder, element.expression.firstChild, SolColor .GLOBAL )
@@ -58,7 +62,17 @@ class SolidityAnnotator : Annotator {
58
62
applyColor(holder, element.identifier, SolColor .STATE_VARIABLE )
59
63
}
60
64
}
61
- is SolFunctionDefinition -> element.identifier?.let { applyColor(holder, it, SolColor .FUNCTION_DECLARATION ) }
65
+ is SolFunctionDefinition -> {
66
+ val identifier = element.identifier
67
+ if (identifier != = null ) {
68
+ applyColor(holder, identifier, SolColor .FUNCTION_DECLARATION )
69
+ } else {
70
+ val firstChildNode = element.node.firstChildNode
71
+ if (firstChildNode.text == " receive" || firstChildNode.text == " fallback" ) {
72
+ applyColor(holder, firstChildNode.textRange, SolColor .RECEIVE_FALLBACK_DECLARATION )
73
+ }
74
+ }
75
+ }
62
76
is SolModifierDefinition -> element.identifier?.let { applyColor(holder, it, SolColor .FUNCTION_DECLARATION ) }
63
77
is SolModifierInvocation -> applyColor(holder, element.varLiteral.identifier, SolColor .FUNCTION_CALL )
64
78
is SolUserDefinedTypeName -> {
@@ -72,6 +86,7 @@ class SolidityAnnotator : Annotator {
72
86
is SolFunctionCallElement -> when (element.firstChild.text) {
73
87
" keccak256" -> applyColor(holder, element.firstChild, SolColor .GLOBAL_FUNCTION_CALL )
74
88
" require" -> applyColor(holder, element.firstChild, SolColor .KEYWORD )
89
+ " assert" -> applyColor(holder, element.firstChild, SolColor .KEYWORD )
75
90
else -> when (SolResolver .resolveTypeNameUsingImports(element).firstOrNull()) {
76
91
is SolErrorDefinition -> applyColor(holder, element.referenceNameElement, SolColor .ERROR_NAME )
77
92
is SolEventDefinition -> applyColor(holder, element.referenceNameElement, SolColor .EVENT_NAME )
0 commit comments