Commit 2dcb41a8 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #720 from ethereum/viewPure

Also treat view and pure functions as constant.
parents 1ea66f16 da1f2434
...@@ -32,7 +32,7 @@ var basicRegex = { ...@@ -32,7 +32,7 @@ var basicRegex = {
CONTRACTTYPE: '^contract ', CONTRACTTYPE: '^contract ',
FUNCTIONTYPE: '^function \\(', FUNCTIONTYPE: '^function \\(',
EXTERNALFUNCTIONTYPE: '^function \\(.*\\).* external', EXTERNALFUNCTIONTYPE: '^function \\(.*\\).* external',
CONSTANTFUNCTIONTYPE: '^function \\(.*\\).* constant', CONSTANTFUNCTIONTYPE: '^function \\(.*\\).* (constant|view|pure)',
REFTYPE: '( storage )|(mapping\\()|(\\[\\])', REFTYPE: '( storage )|(mapping\\()|(\\[\\])',
FUNCTIONSIGNATURE: '^function \\(([^\\(]*)\\)', FUNCTIONSIGNATURE: '^function \\(([^\\(]*)\\)',
LIBRARYTYPE: '^type\\(library (.*)\\)' LIBRARYTYPE: '^type\\(library (.*)\\)'
...@@ -442,7 +442,11 @@ function isStateVariable (name, stateVariables) { ...@@ -442,7 +442,11 @@ function isStateVariable (name, stateVariables) {
* @return {bool} * @return {bool}
*/ */
function isConstantFunction (node) { function isConstantFunction (node) {
return isFunctionDefinition(node) && node.attributes.constant === true return isFunctionDefinition(node) && (
node.attributes.constant === true ||
node.attributes.stateMutability === 'view' ||
node.attributes.stateMutability === 'pure'
)
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment