From a8ad00abbb63c77b611ee64449f7787159ebd52d Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Sun, 17 Nov 2024 15:14:36 +0800 Subject: [PATCH] fix merge conflict --- vyper/ast/pre_parser.py | 44 +++++------------------------------------ 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/vyper/ast/pre_parser.py b/vyper/ast/pre_parser.py index fd1360ad0f..542c345e58 100644 --- a/vyper/ast/pre_parser.py +++ b/vyper/ast/pre_parser.py @@ -228,34 +228,6 @@ def parse(self, code: str): compiler_version = pragma.removeprefix("version ").strip() validate_version_pragma(compiler_version, code, start) settings.compiler_version = compiler_version - # TODO: refactor these to something like Settings.from_pragma - elif pragma.startswith("optimize "): - if settings.optimize is not None: - raise StructureException("pragma optimize specified twice!", start) - try: - mode = pragma.removeprefix("optimize").strip() - settings.optimize = OptimizationLevel.from_string(mode) - except ValueError: - raise StructureException(f"Invalid optimization mode `{mode}`", start) - elif pragma.startswith("evm-version "): - if settings.evm_version is not None: - raise StructureException("pragma evm-version specified twice!", start) - evm_version = pragma.removeprefix("evm-version").strip() - if evm_version not in EVM_VERSIONS: - raise StructureException(f"Invalid evm version: `{evm_version}`", start) - settings.evm_version = evm_version - elif pragma.startswith("experimental-codegen") or pragma.startswith("venom"): - if settings.experimental_codegen is not None: - raise StructureException( - "pragma experimental-codegen/venom specified twice!", start - ) - settings.experimental_codegen = True - elif pragma.startswith("enable-decimals"): - if settings.enable_decimals is not None: - raise StructureException( - "pragma enable_decimals specified twice!", start - ) - settings.enable_decimals = True # TODO: refactor these to something like Settings.from_pragma elif pragma.startswith("optimize "): @@ -265,24 +237,18 @@ def parse(self, code: str): mode = pragma.removeprefix("optimize").strip() settings.optimize = OptimizationLevel.from_string(mode) except ValueError: - raise StructureException( - f"Invalid optimization mode `{mode}`", start - ) + raise StructureException(f"Invalid optimization mode `{mode}`", start) elif pragma.startswith("evm-version "): if settings.evm_version is not None: - raise StructureException( - "pragma evm-version specified twice!", start - ) + raise StructureException("pragma evm-version specified twice!", start) evm_version = pragma.removeprefix("evm-version").strip() if evm_version not in EVM_VERSIONS: - raise StructureException( - f"Invalid evm version: `{evm_version}`", start - ) + raise StructureException(f"Invalid evm version: `{evm_version}`", start) settings.evm_version = evm_version - elif pragma.startswith("experimental-codegen"): + elif pragma.startswith("experimental-codegen") or pragma.startswith("venom"): if settings.experimental_codegen is not None: raise StructureException( - "pragma experimental-codegen specified twice!", start + "pragma experimental-codegen/venom specified twice!", start ) settings.experimental_codegen = True elif pragma.startswith("enable-decimals"):