From 59955bed5d5c3a4f4635a430b4402cf756fa1b8f Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Mon, 9 Sep 2019 12:49:54 +0200 Subject: [PATCH] Adds reserved keyword `virtual`, and adjusting affected tests/docs respectively. --- Changelog.md | 1 + docs/060-breaking-changes.rst | 2 ++ docs/miscellaneous.rst | 2 +- liblangutil/Token.h | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9f56930ff..2b1022926 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Breaking changes: * ABI: the ``type`` field is now required and no longer specified to default to ``function``. * Commandline interface: remove the text-based ast printer (``--ast``). * General: Disallow explicit conversions from external function types to ``address`` and add a member called ``address`` to them as replacement. + * General: New reserved keywords: ``virtual``. * Type checker: Resulting type of exponentiation is equal to the type of the base. Also allow signed types for the base. * Command line interface: Switch to the new error reporter by default. ``--old-reporter`` falls back to the deprecated old error reporter. diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index 6c80cc2a7..173c05901 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -17,6 +17,8 @@ This section lists purely syntactic changes that do not affect the behavior of e * Conversions from external function types to ``address`` are now disallowed. Instead external function types have a member called ``address``, similar to the existing ``selector`` member. +* New reserved keywords: ``virtual``. + Semantic Only Changes ===================== diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 137513b83..0111fa4a1 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -450,7 +450,7 @@ These keywords are reserved in Solidity. They might become part of the syntax in ``define``, ``final``, ``immutable``, ``implements``, ``in``, ``inline``, ``let``, ``macro``, ``match``, ``mutable``, ``null``, ``of``, ``override``, ``partial``, ``promise``, ``reference``, ``relocatable``, ``sealed``, ``sizeof``, ``static``, ``supports``, ``switch``, ``try``, ``typedef``, ``typeof``, -``unchecked``. +``unchecked``, ``virtual``. Language Grammar ================ diff --git a/liblangutil/Token.h b/liblangutil/Token.h index c725c43bd..9bac424b7 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -262,6 +262,7 @@ namespace langutil K(Typedef, "typedef", 0) \ K(TypeOf, "typeof", 0) \ K(Unchecked, "unchecked", 0) \ + K(Virtual, "virtual", 0) \ \ /* Illegal token - not able to scan. */ \ T(Illegal, "ILLEGAL", 0) \ @@ -310,7 +311,7 @@ namespace TokenTraits constexpr bool isEtherSubdenomination(Token op) { return op == Token::SubWei || op == Token::SubSzabo || op == Token::SubFinney || op == Token::SubEther; } constexpr bool isTimeSubdenomination(Token op) { return op == Token::SubSecond || op == Token::SubMinute || op == Token::SubHour || op == Token::SubDay || op == Token::SubWeek || op == Token::SubYear; } - constexpr bool isReservedKeyword(Token op) { return (Token::Abstract <= op && op <= Token::Unchecked); } + constexpr bool isReservedKeyword(Token op) { return (Token::Abstract <= op && op <= Token::Virtual); } inline Token AssignmentToBinaryOp(Token op) {