Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
55bdcfae
Commit
55bdcfae
authored
Sep 15, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1806 from ethersphere/solc2
new solc api - late fixes
parents
071e2cd0
3a5e7ed9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
solidity.go
common/compiler/solidity.go
+11
-11
solidity_test.go
common/compiler/solidity_test.go
+3
-3
No files found.
common/compiler/solidity.go
View file @
55bdcfae
...
@@ -35,8 +35,8 @@ import (
...
@@ -35,8 +35,8 @@ import (
)
)
var
(
var
(
versionReg
E
xp
=
regexp
.
MustCompile
(
"[0-9]+
\\
.[0-9]+
\\
.[0-9]+"
)
versionReg
e
xp
=
regexp
.
MustCompile
(
"[0-9]+
\\
.[0-9]+
\\
.[0-9]+"
)
newAPIRegexp
=
regexp
.
MustCompile
(
"0
\\
.1
\\
.[2-9][0-9]*
"
)
legacyRegexp
=
regexp
.
MustCompile
(
"0
\\
.(9
\\
..*|1
\\
.[01])
"
)
paramsLegacy
=
[]
string
{
paramsLegacy
=
[]
string
{
"--binary"
,
// Request to output the contract in binary (hexadecimal).
"--binary"
,
// Request to output the contract in binary (hexadecimal).
"file"
,
//
"file"
,
//
...
@@ -50,13 +50,13 @@ var (
...
@@ -50,13 +50,13 @@ var (
"1"
,
"1"
,
}
}
paramsNew
=
[]
string
{
paramsNew
=
[]
string
{
"--bin"
,
// Request to output the contract in binary (hexadecimal).
"--bin"
,
// Request to output the contract in binary (hexadecimal).
"--abi"
,
// Request to output the contract's JSON ABI interface.
"--abi"
,
// Request to output the contract's JSON ABI interface.
"--userdoc"
,
// Request to output the contract's Natspec user documentation.
"--userdoc"
,
// Request to output the contract's Natspec user documentation.
"--devdoc"
,
// Request to output the contract's Natspec developer documentation.
"--devdoc"
,
// Request to output the contract's Natspec developer documentation.
"--add-std"
,
// include standard lib contracts
"--add-std"
,
// include standard lib contracts
"--optimize
=1
"
,
// code optimizer switched on
"--optimize"
,
// code optimizer switched on
"-o"
,
// output directory
"-o"
,
// output directory
}
}
)
)
...
@@ -102,8 +102,8 @@ func New(solcPath string) (sol *Solidity, err error) {
...
@@ -102,8 +102,8 @@ func New(solcPath string) (sol *Solidity, err error) {
}
}
fullVersion
:=
out
.
String
()
fullVersion
:=
out
.
String
()
version
:=
versionReg
E
xp
.
FindString
(
fullVersion
)
version
:=
versionReg
e
xp
.
FindString
(
fullVersion
)
legacy
:=
!
newAPI
Regexp
.
MatchString
(
version
)
legacy
:=
legacy
Regexp
.
MatchString
(
version
)
sol
=
&
Solidity
{
sol
=
&
Solidity
{
solcPath
:
solcPath
,
solcPath
:
solcPath
,
...
...
common/compiler/solidity_test.go
View file @
55bdcfae
...
@@ -46,9 +46,9 @@ contract test {
...
@@ -46,9 +46,9 @@ contract test {
func
TestCompiler
(
t
*
testing
.
T
)
{
func
TestCompiler
(
t
*
testing
.
T
)
{
sol
,
err
:=
New
(
""
)
sol
,
err
:=
New
(
""
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Skip
(
"solc not found: skip
: %v"
,
err
)
t
.
Skip
f
(
"solc not found
: %v"
,
err
)
}
else
if
sol
.
Version
()
!=
solcVersion
{
}
else
if
sol
.
Version
()
!=
solcVersion
{
t
.
Skip
(
"WARNING: skipping due to
a newer version of solc found (%v, expect %v)"
,
sol
.
Version
(),
solcVersion
)
t
.
Skip
f
(
"WARNING:
a newer version of solc found (%v, expect %v)"
,
sol
.
Version
(),
solcVersion
)
}
}
contracts
,
err
:=
sol
.
Compile
(
source
)
contracts
,
err
:=
sol
.
Compile
(
source
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -83,7 +83,7 @@ func TestCompileError(t *testing.T) {
...
@@ -83,7 +83,7 @@ func TestCompileError(t *testing.T) {
func
TestNoCompiler
(
t
*
testing
.
T
)
{
func
TestNoCompiler
(
t
*
testing
.
T
)
{
_
,
err
:=
New
(
"/path/to/solc"
)
_
,
err
:=
New
(
"/path/to/solc"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Log
(
"solidity quits with error: %v"
,
err
)
t
.
Log
f
(
"solidity quits with error: %v"
,
err
)
}
else
{
}
else
{
t
.
Errorf
(
"no solc installed, but got no error"
)
t
.
Errorf
(
"no solc installed, but got no error"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment