SOLL icon indicating copy to clipboard operation
SOLL copied to clipboard

Implement inheritance

Open LFsWang opened this issue 5 years ago • 0 comments

Add support to inheritance

Parser

  • New keywords
  • [x] abstract
  • [x] is
  • [x] override
  • [x] virtual
  • [x] interface
  • structure
  • [ ] identifier-path
  • [x] inheritance-specifier
  • [x] override-specifier
  • Add new ability on AST for inheritance

Analysis

  • Function Overriding
  • [x] Base functions can be overridden by inheriting contracts to change their behavior if they are marked as virtual
  • [x] The overriding function must then use the override keyword in the function header
  • [x] The overriding function may only change the visibility of the overridden function from external to public
  • [x] nonpayable can be overridden by view and pure
  • [x] view can be overridden by pure
  • [x] payable is an exception and cannot be changed to any other mutability.
  • [ ] For multiple inheritance, the most derived base contracts that define the same function must be specified explicitly after the override
  • [x] Functions with the private visibility cannot be virtual
  • [ ] Public state variables can override external functions if the parameter and return types of the function matches the getter function of the variable:
  • Modifier Overriding (The details is as same as Function Overriding)
  • [ ] modifier support.
  • Constructors

  • Multiple Inheritance and Linearization

  • [x] C3 Linearization (Build inheritance graph)
  • [ ] Inheriting Different Kinds of Members of the Same Name
  • Abstract Contracts

  • Interfaces

  • [x] They cannot inherit from other contracts, but they can inherit from other interfaces.

  • [x] All declared functions must be external

  • [x] They cannot declare a constructor.

  • [x] They cannot declare state variables.

  • [x] All functions declared in interfaces are implicitly virtual

  • contract injector

LFsWang avatar Dec 10 '20 08:12 LFsWang