aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-11 05:58:23 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-13 23:10:37 +0800
commitb2fcd59ee6941de4a392b89295c734385d6019e3 (patch)
tree7f40372a2d95ec35ed707bdd63958bb9e68b97ee /docs
parent9a5aac599e0003009fd0ba1794c6a02d97b3d026 (diff)
downloaddexon-solidity-b2fcd59ee6941de4a392b89295c734385d6019e3.tar.gz
dexon-solidity-b2fcd59ee6941de4a392b89295c734385d6019e3.tar.zst
dexon-solidity-b2fcd59ee6941de4a392b89295c734385d6019e3.zip
Add version pragma to docs examples
Diffstat (limited to 'docs')
-rw-r--r--docs/abi-spec.rst2
-rw-r--r--docs/assembly.rst2
-rw-r--r--docs/control-structures.rst10
-rw-r--r--docs/miscellaneous.rst2
4 files changed, 16 insertions, 0 deletions
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index d915973d..82c52159 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -182,6 +182,8 @@ Given the contract:
::
+ pragma solidity ^0.4.0;
+
contract Foo {
function bar(bytes3[2] xy) {}
function baz(uint32 x, bool y) returns (bool r) { r = x > 32 || y; }
diff --git a/docs/assembly.rst b/docs/assembly.rst
index 0a120644..37222faf 100644
--- a/docs/assembly.rst
+++ b/docs/assembly.rst
@@ -679,6 +679,8 @@ Example:
We will follow an example compilation from Solidity to desugared assembly.
We consider the runtime bytecode of the following Solidity program::
+ pragma solidity ^0.4.0;
+
contract C {
function f(uint x) returns (uint y) {
y = 1;
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 03787c20..c7185e22 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -20,6 +20,8 @@ For example, suppose we want our contract to
accept one kind of external calls with two integers, we would write
something like::
+ pragma solidity ^0.4.0;
+
contract Simple {
function taker(uint _a, uint _b) {
// do something with _a and _b.
@@ -34,6 +36,8 @@ The output parameters can be declared with the same syntax after the
the sum and the product of the two given integers, then we would
write::
+ pragma solidity ^0.4.0;
+
contract Simple {
function arithmetics(uint _a, uint _b) returns (uint o_sum, uint o_product) {
o_sum = _a + _b;
@@ -91,6 +95,8 @@ Internal Function Calls
Functions of the current contract can be called directly ("internally"), also recursively, as seen in
this nonsensical example::
+ pragma solidity ^0.4.0;
+
contract C {
function g(uint a) returns (uint ret) { return f(); }
function f() returns (uint ret) { return g(7) + f(); }
@@ -116,6 +122,8 @@ all function arguments have to be copied to memory.
When calling functions of other contracts, the amount of Wei sent with the call and
the gas can be specified with special options ``.value()`` and ``.gas()``, respectively::
+ pragma solidity ^0.4.0;
+
contract InfoFeed {
function info() payable returns (uint ret) { return 42; }
}
@@ -261,6 +269,8 @@ Destructuring Assignments and Returning Multiple Values
Solidity internally allows tuple types, i.e. a list of objects of potentially different types whose size is a constant at compile-time. Those tuples can be used to return multiple values at the same time and also assign them to multiple variables (or LValues in general) at the same time::
+ pragma solidity ^0.4.0;
+
contract C {
uint[] data;
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 182de33a..1fcdb2fc 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -48,6 +48,8 @@ non-elementary type, the positions are found by adding an offset of ``keccak256(
So for the following contract snippet::
+ pragma solidity ^0.4.0;
+
contract C {
struct s { uint a; uint b; }
uint x;