Fix function stealing 'goto def's

This commit is contained in:
Kirill Andreev 2020-07-08 18:55:11 +04:00
parent 29bc1721d1
commit ba3c0a76d9
No known key found for this signature in database
GPG Key ID: CF7DA79DE4785A47
3 changed files with 27 additions and 13 deletions

View File

@ -685,7 +685,7 @@ fun_call = do
subtree "fun_call" do
ranged do
pure Apply
<*> ranged do pure Ident <*> inside "f" function_id
<*> inside "f" function_id
<*> inside "arguments" arguments
arguments :: Parser [Pascal ASTInfo]
@ -694,16 +694,17 @@ arguments =
many do inside "argument" expr
function_id :: Parser (Pascal ASTInfo)
function_id = select
[ qname
, do
subtree "module_field" do
ranged do
pure QualifiedName
<*> inside "module" capitalName
<*> do pure <$> ranged do
pure At <*> inside "method" do name <|> name'
]
function_id = ranged do
pure Ident <*> select
[ qname
, do
subtree "module_field" do
ranged do
pure QualifiedName
<*> inside "module" capitalName
<*> do pure <$> ranged do
pure At <*> inside "method" do name <|> name'
]
opCall :: Parser (Pascal ASTInfo)
opCall = do
@ -848,7 +849,7 @@ typeTuple = do
-- example = "../../../src/test/contracts/amount.ligo"
-- example = "../../../src/test/contracts/annotation.ligo"
-- example = "../../../src/test/contracts/arithmetic.ligo"
-- example = "../../../src/test/contracts/assign.ligo"
example = "../../../src/test/contracts/assign.ligo"
-- example = "../../../src/test/contracts/attributes.ligo"
-- example = "../../../src/test/contracts/bad_timestamp.ligo"
-- example = "../../../src/test/contracts/bad_type_operator.ligo"
@ -864,7 +865,7 @@ typeTuple = do
-- example = "../../../src/test/contracts/failwith.ligo"
-- example = "../../../src/test/contracts/loop.ligo"
-- example = "../../../src/test/contracts/redeclaration.ligo"
example = "../../../src/test/contracts/includer.ligo"
-- example = "../../../src/test/contracts/includer.ligo"
-- example = "../../../src/test/contracts/application.ligo"
-- example = "../../../src/test/contracts/application.ligo"
-- example = "../../../src/test/contracts/application.ligo"

View File

@ -36,6 +36,7 @@ module Parser
( -- * Parser type
Parser
, runParser
, runParser'
, debugParser
-- * Combinators
@ -62,6 +63,8 @@ module Parser
-- * Comments and ranges
, ASTInfo(..)
, Source(..)
, module ParseTree
) where
import Control.Monad.Writer hiding (Product)
@ -117,6 +120,12 @@ runParser parser fin = do
(Cons Set.empty
Nil)))
runParser'
:: Parser a
-> Source
-> IO a
runParser' parser fin = fst <$> runParser parser fin
restart :: Stubbed a ASTInfo => Parser a -> FilePath -> Parser a
restart p fin = do
dir <- get' @FilePath

View File

@ -7,6 +7,7 @@ module Range
, HasRange(..)
, diffRange
, cutOut
, point
)
where
@ -21,6 +22,9 @@ import Pretty
import Lattice
import Product
point :: Int -> Int -> Range
point l c = Range (l, c, 0) (l, c, 0) ""
-- | A continious location in text.
data Range = Range
{ rStart :: (Int, Int, Int) -- ^ [Start: line, col, byte-offset...