Use semver to turn on interface features

pull/1/head
Alex Beregszaszi 8 years ago
parent 78bb4e0f76
commit 8229fc358a
  1. 1
      package.json
  2. 11
      src/app/compiler.js

@ -53,6 +53,7 @@
"jquery": "^2.2.0",
"js-base64": "^2.1.9",
"nightwatch": "^0.9.3",
"semver": "^5.3.0",
"solc": "https://github.com/ethereum/solc-js",
"standard": "^8.5.0",
"tape": "^4.5.1",

@ -2,6 +2,7 @@
var solc = require('solc/wrapper')
var semver = require('semver')
var webworkify = require('webworkify')
var utils = require('./utils')
@ -20,6 +21,8 @@ function Compiler (editor, handleGithubCall) {
var cachedRemoteFiles = {}
var worker = null
var currentVersion
var optimize = false
this.setOptimize = function (_optimize) {
@ -53,6 +56,7 @@ function Compiler (editor, handleGithubCall) {
this.setCompileJSON = setCompileJSON // this is exposed for testing
function onCompilerLoaded (version) {
currentVersion = version
self.event.trigger('compilerLoaded', [version])
}
@ -294,11 +298,14 @@ function Compiler (editor, handleGithubCall) {
// add "payable" to everything
// FIXME: only for compiler <0.4.0
if (semver.lt(currentVersion, '0.4.0')) {
item.payable = true
}
}
// FIXME: only for compiler <0.x.y
if (!hasConstructor) {
// 0.1.2 from Aug 2015 had it. The code has it since May 2015 (e7931ade)
if (!hasConstructor && semver.lt(currentVersion, '0.1.2')) {
abi.push({
type: 'constructor',
payable: true,
@ -307,7 +314,7 @@ function Compiler (editor, handleGithubCall) {
}
// FIXME: only for compiler <0.4.0
if (!hasFallback) {
if (!hasFallback && semver.lt(currentVersion, '0.4.0')) {
abi.push({
type: 'fallback',
payable: true

Loading…
Cancel
Save