Browse Source

Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop

cl-refactor
Gav Wood 10 years ago
parent
commit
cca958d588
  1. 9
      libsolidity/InterfaceHandler.cpp
  2. 2
      libsolidity/Types.cpp
  3. 4
      mix/main.cpp
  4. 7
      mix/qml/Debugger.qml
  5. 6
      mix/qml/DefaultLabel.qml
  6. 7
      mix/qml/DefaultTextField.qml
  7. 8
      mix/qml/Ether.qml
  8. 2
      mix/qml/StateDialog.qml
  9. 10
      mix/qml/TransactionDialog.qml
  10. 14
      mix/qml/WebPreview.qml
  11. 28
      test/SolidityInterface.cpp

9
libsolidity/InterfaceHandler.cpp

@ -108,16 +108,7 @@ unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition
ret.pop_back();
ret += "{}";
}
for (auto const& it: _contractDef.getInterfaceEvents())
{
std::string params;
for (auto const& p: it->getParameters())
params += (params.empty() ? "(" : ",") + p->getType()->toString() + (p->isIndexed() ? " indexed " : " ") + p->getName();
if (!params.empty())
params += ")";
ret += "event " + it->getName() + params + ";";
}
return unique_ptr<string>(new string(ret + "}"));
}

2
libsolidity/Types.cpp

@ -769,7 +769,7 @@ FunctionType::FunctionType(VariableDeclaration const& _varDecl):
}
FunctionType::FunctionType(const EventDefinition& _event):
m_location(Location::Event), m_declaration(&_event)
m_location(Location::Event), m_isConstant(true), m_declaration(&_event)
{
TypePointers params;
vector<string> paramNames;

4
mix/main.cpp

@ -36,6 +36,10 @@ int main(int _argc, char* _argv[])
//https://bugs.launchpad.net/ubuntu/+source/appmenu-qt5/+bug/1323853
putenv((char*)"QT_QPA_PLATFORMTHEME=");
putenv((char*)"QSG_RENDER_LOOP=threaded");
#endif
#if (defined(_WIN32) || defined(_WIN64))
if (!getenv("OPENSSL_CONF"))
putenv((char*)"OPENSSL_CONF=c:\\");
#endif
try
{

7
mix/qml/Debugger.qml

@ -131,7 +131,14 @@ Rectangle {
Layout.fillWidth: true
Layout.minimumHeight: 60
height: 250
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: machineStates.sideMargin
anchors.rightMargin: machineStates.sideMargin
anchors.topMargin: machineStates.sideMargin
}
ScrollView
{
property int sideMargin: 10

6
mix/qml/DefaultLabel.qml

@ -4,12 +4,6 @@ import "."
Label {
text: text
font.family: regularFont.name
font.pointSize: Style.generic.size.titlePointSize
SourceSansProLight
{
id: regularFont
}
}

7
mix/qml/DefaultTextField.qml

@ -3,11 +3,4 @@ import QtQuick.Controls 1.1
TextField {
id: titleField
focus: true
font.family: regularFont.name
SourceSansProRegular
{
id: regularFont;
}
}

8
mix/qml/Ether.qml

@ -49,10 +49,6 @@ RowLayout {
id: etherValueEdit;
}
SourceSansProBold {
id: regularFont;
}
ComboBox
{
id: units
@ -87,15 +83,11 @@ RowLayout {
ListElement { text: "Kwei"; }
ListElement { text: "wei"; }
}
style: ComboBoxStyle {
font: regularFont.name
}
}
Text
{
visible: displayFormattedValue
id: formattedValue
font.family: regularFont.name
}
}

2
mix/qml/StateDialog.qml

@ -12,7 +12,7 @@ Window {
id: modalStateDialog
modality: Qt.ApplicationModal
width: 450
width: 520
height: 480
title: qsTr("Edit State")
visible: false

10
mix/qml/TransactionDialog.qml

@ -10,7 +10,7 @@ import "."
Window {
id: modalTransactionDialog
modality: Qt.ApplicationModal
width: 450
width: 520
height: (paramsModel.count > 0 ? 500 : 300)
visible: false
color: StateDialogStyle.generic.backgroundColor
@ -174,11 +174,6 @@ Window {
anchors.fill: parent
anchors.margins: 10
SourceSansProLight
{
id: lightFont
}
ColumnLayout {
id: dialogContent
anchors.top: parent.top
@ -204,9 +199,6 @@ Window {
onCurrentIndexChanged: {
loadParameters();
}
style: ComboBoxStyle {
font: lightFont.name
}
}
}

14
mix/qml/WebPreview.qml

@ -162,11 +162,6 @@ Item {
spacing: 0
Rectangle
{
SourceSansProLight
{
id: regularFont
}
anchors.leftMargin: 4
color: WebPreviewStyle.general.headerBackgroundColor
Layout.preferredWidth: parent.width
@ -188,9 +183,7 @@ Item {
currentIndex: -1
onCurrentIndexChanged: changePage()
anchors.verticalCenter: parent.verticalCenter
style: ComboBoxStyle {
font: regularFont.name
}
height: 21
}
Action {
@ -205,12 +198,13 @@ Item {
iconSource: "qrc:/qml/img/available_updates.png"
action: buttonReloadAction
anchors.verticalCenter: parent.verticalCenter
width: 26
height: 26
width: 21
height: 21
}
CheckBox {
id: autoReloadOnSave
checked: true
height: 21
anchors.verticalCenter: parent.verticalCenter
style: CheckBoxStyle {
label: DefaultLabel {

28
test/SolidityInterface.cpp

@ -111,24 +111,6 @@ BOOST_AUTO_TEST_CASE(exclude_fallback_function)
BOOST_CHECK_EQUAL(getSourcePart(contract), "contract test{}");
}
BOOST_AUTO_TEST_CASE(event)
{
ContractDefinition const& contract = checkInterface(
"contract test { event Event; }");
BOOST_REQUIRE_EQUAL(1, contract.getEvents().size());
BOOST_CHECK_EQUAL(getSourcePart(*contract.getEvents().front()),
"event Event;");
}
BOOST_AUTO_TEST_CASE(event_arguments)
{
ContractDefinition const& contract = checkInterface(
"contract test { event Event(uint a, uint indexed b); }");
BOOST_REQUIRE_EQUAL(1, contract.getEvents().size());
BOOST_CHECK_EQUAL(getSourcePart(*contract.getEvents().front()),
"event Event(uint256 a,uint256 indexed b);");
}
BOOST_AUTO_TEST_CASE(events)
{
char const* sourceCode = "contract test {\n"
@ -137,10 +119,8 @@ BOOST_AUTO_TEST_CASE(events)
" event e2(); \n"
"}\n";
ContractDefinition const& contract = checkInterface(sourceCode);
set<string> expectation({"event e1(uint256 b,address indexed c);", "event e2;"});
BOOST_REQUIRE_EQUAL(2, contract.getEvents().size());
BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.getEvents().at(0)),
getSourcePart(*contract.getEvents().at(1))}));
// events should not appear in the Solidity Interface
BOOST_REQUIRE_EQUAL(0, contract.getEvents().size());
}
BOOST_AUTO_TEST_CASE(inheritance)
@ -155,12 +135,8 @@ BOOST_AUTO_TEST_CASE(inheritance)
" event derivedEvent(uint indexed evtArgDerived); \n"
" }";
ContractDefinition const& contract = checkInterface(sourceCode);
set<string> expectedEvents({"event derivedEvent(uint256 indexed evtArgDerived);",
"event baseEvent(string32 indexed evtArgBase);"});
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
"function derivedFunction(string32 p)returns(string32 i){}"});
BOOST_CHECK(expectedEvents == set<string>({getSourcePart(*contract.getEvents().at(0)),
getSourcePart(*contract.getEvents().at(1))}));
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
getSourcePart(*contract.getDefinedFunctions().at(1))}));

Loading…
Cancel
Save