ソースを参照

Remove szabo and finney units

These were removed in solc 0.7.0, and now no longer reserved keywords.

Signed-off-by: Sean Young <sean@mess.org>
Sean Young 3 年 前
コミット
6fadcac1de

+ 0 - 2
docs/language.rst

@@ -1341,8 +1341,6 @@ Unit        Multiplier
 ``days``    86400
 ``weeks``   604800
 ``wei``     1
-``szabo``   1_000_000_000_000
-``finney``  1_000_000_000_000_000
 ``ether``   1_000_000_000_000_000_000
 =========== =========================
 

+ 0 - 6
solang-parser/src/lexer.rs

@@ -158,8 +158,6 @@ pub enum Token<'input> {
     Weeks,
     Gwei,
     Wei,
-    Szabo,
-    Finney,
     Ether,
 
     This,
@@ -308,8 +306,6 @@ impl<'input> fmt::Display for Token<'input> {
             Token::Weeks => write!(f, "weeks"),
             Token::Gwei => write!(f, "gwei"),
             Token::Wei => write!(f, "wei"),
-            Token::Szabo => write!(f, "szabo"),
-            Token::Finney => write!(f, "finney"),
             Token::Ether => write!(f, "ether"),
             Token::This => write!(f, "this"),
             Token::As => write!(f, "as"),
@@ -549,8 +545,6 @@ static KEYWORDS: phf::Map<&'static str, Token> = phf_map! {
     "weeks" => Token::Weeks,
     "wei" => Token::Wei,
     "gwei" => Token::Gwei,
-    "szabo" => Token::Szabo,
-    "finney" => Token::Finney,
     "ether" => Token::Ether,
     "this" => Token::This,
     "as" => Token::As,

+ 0 - 2
solang-parser/src/pt.rs

@@ -349,8 +349,6 @@ pub enum Unit {
     Weeks(Loc),
     Wei(Loc),
     Gwei(Loc),
-    Szabo(Loc),
-    Finney(Loc),
     Ether(Loc),
 }
 

+ 0 - 4
solang-parser/src/solidity.lalrpop

@@ -536,8 +536,6 @@ Unit: Unit = {
     <@L> "weeks" <@R> => Unit::Weeks(Loc::File(file_no, <>)),
     <@L> "wei" <@R> => Unit::Wei(Loc::File(file_no, <>)),
     <@L> "gwei" <@R> => Unit::Gwei(Loc::File(file_no, <>)),
-    <@L> "szabo" <@R> => Unit::Szabo(Loc::File(file_no, <>)),
-    <@L> "finney" <@R> => Unit::Finney(Loc::File(file_no, <>)),
     <@L> "ether" <@R> => Unit::Ether(Loc::File(file_no, <>)),
 }
 
@@ -1148,8 +1146,6 @@ extern {
         "weeks" => Token::Weeks,
         "wei" => Token::Wei,
         "gwei" => Token::Gwei,
-        "szabo" => Token::Szabo,
-        "finney" => Token::Finney,
         "ether" => Token::Ether,
         "this" => Token::This,
         "as" => Token::As,

+ 1 - 7
src/sema/expression.rs

@@ -1956,11 +1956,7 @@ pub fn expression(
             };
 
             match unit {
-                pt::Unit::Wei(loc)
-                | pt::Unit::Gwei(loc)
-                | pt::Unit::Finney(loc)
-                | pt::Unit::Szabo(loc)
-                | pt::Unit::Ether(loc)
+                pt::Unit::Wei(loc) | pt::Unit::Gwei(loc) | pt::Unit::Ether(loc)
                     if ns.target != crate::Target::Ewasm =>
                 {
                     diagnostics.push(Diagnostic::warning(
@@ -1981,8 +1977,6 @@ pub fn expression(
                     pt::Unit::Weeks(_) => BigInt::from(60 * 60 * 24 * 7),
                     pt::Unit::Wei(_) => BigInt::from(1),
                     pt::Unit::Gwei(_) => BigInt::from(10).pow(9u32),
-                    pt::Unit::Szabo(_) => BigInt::from(10).pow(12u32),
-                    pt::Unit::Finney(_) => BigInt::from(10).pow(15u32),
                     pt::Unit::Ether(_) => BigInt::from(10).pow(18u32),
                 }),
                 ns,

+ 0 - 2
tests/substrate_tests/primitives.rs

@@ -290,8 +290,6 @@ fn units() {
             function foo() public {
                 assert(10 wei == 10);
                 assert(1 gwei == 1000_000_000);
-                assert(1 szabo == 1000_000_000_000);
-                assert(1 finney == 1000_000_000_000_000);
                 assert(1 ether == 1000_000_000_000_000_000);
             }
         }"##,

+ 2 - 2
vscode/syntaxes/solidity.json

@@ -258,7 +258,7 @@
             "name": "constant.language.time.solidity"
         },
         "constant-currency": {
-            "match": "\\b(ether|wei|finney|szabo)\\b",
+            "match": "\\b(ether|wei)\\b",
             "name": "constant.language.currency.solidity"
         },
         "number": {
@@ -537,4 +537,4 @@
     },
     "scopeName": "source.solidity",
     "uuid": "123"
-}
+}