refactor compilerInput && update change on legacy features

pull/3094/head
yann300 7 years ago
parent b3ae1c4e41
commit ca65d66a6b
  1. 4
      remix-lib/index.js
  2. 26
      remix-lib/src/helpers/compilerHelper.js
  3. 23
      remix-lib/test/sourceMappingDecoder.js
  4. 25
      remix-solidity/test/analysis/staticAnalysisIntegration-test.js
  5. 24
      remix-solidity/test/decoder/decodeInfo.js
  6. 23
      remix-solidity/test/decoder/localDecoder.js

@ -2,6 +2,7 @@
var EventManager = require('./src/eventManager')
var traceHelper = require('./src/helpers/traceHelper')
var uiHelper = require('./src/helpers/uiHelper')
var compilerHelper = require('./src/helpers/compilerHelper')
var SourceMappingDecoder = require('./src/sourceMappingDecoder')
var SourceLocationTracker = require('./src/sourceLocationTracker')
var init = require('./src/init')
@ -26,7 +27,8 @@ function modules () {
EventManager: EventManager,
helpers: {
trace: traceHelper,
ui: uiHelper
ui: uiHelper,
compiler: compilerHelper
},
vm: {
Web3Providers: Web3Providers,

@ -0,0 +1,26 @@
module.exports = {
compilerInput: compilerInput
}
function compilerInput (contracts) {
return JSON.stringify({
language: 'Solidity',
sources: {
'test.sol': {
content: contracts
}
},
settings: {
optimizer: {
enabled: false,
runs: 500
}
},
outputSelection: {
'*': {
'': [ 'legacyAST' ],
'*': [ 'abi', 'metadata', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates' ]
}
}
})
}

@ -3,6 +3,7 @@ var tape = require('tape')
var sourceMapping = require('./resources/sourceMapping')
var SourceMappingDecoder = require('../src/sourceMappingDecoder')
var compiler = require('solc')
var compilerInput = require('../src/helpers/compilerHelper').compilerInput
tape('SourceMappingDecoder', function (t) {
t.test('SourceMappingDecoder.findNodeAtInstructionIndex', function (st) {
@ -116,25 +117,3 @@ var contracts = `contract test {
}
}
`
function compilerInput (contracts) {
return JSON.stringify({
language: 'Solidity',
sources: {
'test.sol': {
content: contracts
}
},
settings: {
optimizer: {
enabled: false,
runs: 500
}
},
outputSelection: {
'*': {
'*': [ 'metadata', 'evm.bytecode', 'abi', 'legacyAST', 'metadata', 'evm.assembly', 'evm.methodIdentifiers', 'evm.gasEstimates' ]
}
}
})
}

@ -1,7 +1,8 @@
var test = require('tape')
var remixLib = require('remix-lib')
var StatRunner = require('../../src/analysis/staticAnalysisRunner')
// const util = require('util')
var compilerInput = remixLib.helpers.compiler.compilerInput
var solc = require('solc/wrapper')
var compiler = solc(require('../../soljson'))
@ -450,25 +451,3 @@ function runModuleOnFiles (module, t, cb) {
})
})
}
function compilerInput (contracts) {
return JSON.stringify({
language: 'Solidity',
sources: {
'test.sol': {
content: contracts
}
},
settings: {
optimizer: {
enabled: false,
runs: 500
}
},
outputSelection: {
'*': {
'*': [ 'metadata', 'evm.bytecode', 'abi', 'legacyAST', 'metadata', 'evm.assembly', 'evm.methodIdentifiers', 'evm.gasEstimates' ]
}
}
})
}

@ -6,6 +6,8 @@ var decodeInfo = require('../../src/decoder/decodeInfo')
var stateDecoder = require('../../src/decoder/stateDecoder')
var contracts = require('./contracts/miscContracts')
var simplecontracts = require('./contracts/simpleContract')
var remixLib = require('remix-lib')
var compilerInput = remixLib.helpers.compiler.compilerInput
tape('solidity', function (t) {
t.test('astHelper, decodeInfo', function (st) {
@ -92,25 +94,3 @@ function checkDecodeInfo (st, decodeInfo, storageSlots, storageBytes, typeName)
st.equal(decodeInfo.storageBytes, storageBytes)
st.equal(decodeInfo.typeName, typeName)
}
function compilerInput (contracts) {
return JSON.stringify({
language: 'Solidity',
sources: {
'test.sol': {
content: contracts
}
},
settings: {
optimizer: {
enabled: false,
runs: 500
}
},
outputSelection: {
'*': {
'*': [ 'metadata', 'evm.bytecode', 'abi', 'legacyAST', 'metadata', 'evm.assembly', 'evm.methodIdentifiers', 'evm.gasEstimates' ]
}
}
})
}

@ -13,6 +13,7 @@ var intLocalTest = require('./localsTests/int')
var miscLocalTest = require('./localsTests/misc')
var misc2LocalTest = require('./localsTests/misc2')
var structArrayLocalTest = require('./localsTests/structArray')
var compilerInput = remixLib.helpers.compiler.compilerInput
tape('solidity', function (t) {
t.test('local decoder', function (st) {
@ -64,25 +65,3 @@ function test (st, vm, privateKey) {
})
})
}
function compilerInput (contracts) {
return JSON.stringify({
language: 'Solidity',
sources: {
'test.sol': {
content: contracts
}
},
settings: {
optimizer: {
enabled: false,
runs: 500
}
},
outputSelection: {
'*': {
'*': [ 'metadata', 'evm.bytecode', 'abi', 'legacyAST', 'metadata', 'evm.assembly', 'evm.methodIdentifiers', 'evm.gasEstimates' ]
}
}
})
}

Loading…
Cancel
Save