[flang] Add support for BLOCK construct
authorTim Keith <tkeith@nvidia.com>
Mon, 27 Aug 2018 18:48:49 +0000 (11:48 -0700)
committerTim Keith <tkeith@nvidia.com>
Mon, 27 Aug 2018 18:48:49 +0000 (11:48 -0700)
commit13e9617ea2d0e7cdcc08dc0d996395ec1fe81975
treec79b5c5bbcba91d21b4cb20e9b3803ee426dd5ef
parent0abba67179aa6ddfafcdb9496678fac9eb3c479c
[flang] Add support for BLOCK construct

A `BLOCK` statement opens a new scope. It is different from other scopes
in that implicitly typed entities are defined in the enclosing non-block
scope, not immediately in the block. This means that `IMPORT` statements
can cause them to be hidden.

Check that blocks can't have `IMPLICIT` statements in them. It is simpler
for the parser not to deal with the different between a
specification-part and a block-specification-part.

Change `ImplicitRules` to have a parent that is consulted when there isn't
an answer in the current one. For an interface body that does not happen
but for all other nested scopes it does. This parent link eliminates the
need for the `implicitRules_` stack. Make `isImplicitNoneType_` and
`isImplicitNoneExternal_` optional: not set means look in parent.
Fixes flang-compiler/f18#71.

Remove `CurrNonTypeScope()` and put the logic in `Symbol::FindSymbol`.

Original-commit: flang-compiler/f18@a153a2ee33ff493df6d4fb5e20d99d302d76ab43
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
Tree-same-pre-rewrite: false
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/scope.cc
flang/lib/semantics/scope.h
flang/lib/semantics/symbol.cc
flang/test/semantics/CMakeLists.txt
flang/test/semantics/implicit07.f90
flang/test/semantics/implicit08.f90 [new file with mode: 0644]
flang/test/semantics/resolve04.f90
flang/test/semantics/resolve30.f90 [new file with mode: 0644]
flang/test/semantics/symbol05.f90 [new file with mode: 0644]