-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from wavesplatform/IDE-655_compaction_and_unused
Ide 655 compaction and unused
- Loading branch information
Showing
8 changed files
with
156 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{-# STDLIB_VERSION 4 #-} | ||
{-# CONTENT_TYPE DAPP #-} | ||
|
||
let unusedVar = 10 | ||
let fooVar = 42 | ||
func barFunc(barFuncArg1: Int) = 100500 + barFuncArg1 | ||
|
||
@Callable(invocation) | ||
func bazCallableFunc(bazCallableFuncArg1: Int, bazCallableFuncArg2: String) = { | ||
let result = barFunc(fooVar) + bazCallableFuncArg1 | ||
[ | ||
IntegerEntry("integerEntryKey", result), | ||
StringEntry("stringEntryKey", bazCallableFuncArg2) | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const compiler = require('../src'); | ||
const {expect} = require('chai'); | ||
const getRide = require('./utils').getRide; | ||
|
||
describe('Sandbox Test', function () { | ||
this.timeout(50000); | ||
|
||
it('Remove unused code and Compaction mode', () => { | ||
// source | ||
const source = getRide('./ride/compileCompaction.ride'); | ||
|
||
// compile | ||
const baseRes = compiler.compile(source, 3, false, false); | ||
const compactionRes = compiler.compile(source, 3, true, false); | ||
const unusedRes = compiler.compile(source, 3, false, true); | ||
|
||
console.log(`\tBase: ${baseRes.result.size}. | Compaction: ${compactionRes.result.size} | Unused: ${unusedRes.result.size}`); | ||
expect(baseRes.result.size).to.not.equal(compactionRes.result.size); | ||
expect(baseRes.result.size).to.not.equal(unusedRes.result.size); | ||
|
||
// console.log(compiler.decompile(baseRes.result.base64)); | ||
// console.log(compiler.decompile(unusedRes.result.base64)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const getRideSrc = function(filename) { | ||
return fs.readFileSync(path.resolve(__dirname, filename), 'utf8'); | ||
} | ||
|
||
module.exports.getRide = getRideSrc; |