Merge pull request #45 from poanetwork/vb-fix-first-pragma-experimental-detection
Fix first pragma experimental detection
This commit is contained in:
commit
13de1e363d
|
@ -7,18 +7,21 @@ const pragmaExperimentalstr = 'pragma experimental'
|
||||||
function removeDuplicatedExpHeaders(content) {
|
function removeDuplicatedExpHeaders(content) {
|
||||||
//1st pragma solidity declaration
|
//1st pragma solidity declaration
|
||||||
const { firstIndex, lastIndex } = getFirstPragmaExp(content)
|
const { firstIndex, lastIndex } = getFirstPragmaExp(content)
|
||||||
const contentPart = content.substr(lastIndex)
|
if (firstIndex >= 0 && lastIndex > 0) {
|
||||||
let contentFiltered = contentPart
|
const contentPart = content.substr(lastIndex)
|
||||||
//remove other pragma solidity declarations
|
let contentFiltered = contentPart
|
||||||
const regex = new RegExp(pragmaExperimentalstr,'gi')
|
//remove other pragma solidity declarations
|
||||||
let result
|
const regex = new RegExp(pragmaExperimentalstr,'gi')
|
||||||
while ( (result = regex.exec(contentPart)) ) {
|
let result
|
||||||
const start = result.index
|
while ( (result = regex.exec(contentPart)) ) {
|
||||||
const end = start + contentPart.substr(start).indexOf(SEMICOLON) + 1
|
const start = result.index
|
||||||
if (start != firstIndex) contentFiltered = contentFiltered.replace(contentPart.substring(start, end), EMPTY)
|
const end = start + contentPart.substr(start).indexOf(SEMICOLON) + 1
|
||||||
|
if (start != firstIndex) contentFiltered = contentFiltered.replace(contentPart.substring(start, end), EMPTY)
|
||||||
|
}
|
||||||
|
return contentFiltered
|
||||||
|
} else {
|
||||||
|
return content
|
||||||
}
|
}
|
||||||
|
|
||||||
return contentFiltered
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue