1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00

Alias and undef just as function calls

This commit is contained in:
Timothy Clem 2017-07-07 10:51:18 -07:00
parent d470d3218d
commit b63e86a9a5
2 changed files with 4 additions and 20 deletions

View File

@ -154,19 +154,3 @@ newtype ScopeExit a = ScopeExit [a]
instance Eq1 ScopeExit where liftEq = genericLiftEq instance Eq1 ScopeExit where liftEq = genericLiftEq
instance Show1 ScopeExit where liftShowsPrec = genericLiftShowsPrec instance Show1 ScopeExit where liftShowsPrec = genericLiftShowsPrec
-- | Alias statement.
data Alias a = Alias { aliasFrom :: !a, aliasTo :: !a }
deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
instance Eq1 Alias where liftEq = genericLiftEq
instance Show1 Alias where liftShowsPrec = genericLiftShowsPrec
-- | Undef statement.
newtype Undef a = Undef [a]
deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
instance Eq1 Undef where liftEq = genericLiftEq
instance Show1 Undef where liftShowsPrec = genericLiftShowsPrec

View File

@ -48,7 +48,6 @@ type Syntax = '[
, Literal.String , Literal.String
, Literal.Symbol , Literal.Symbol
, Literal.TextElement , Literal.TextElement
, Statement.Alias
, Statement.Assignment , Statement.Assignment
, Statement.Break , Statement.Break
, Statement.Catch , Statement.Catch
@ -62,7 +61,6 @@ type Syntax = '[
, Statement.ScopeEntry , Statement.ScopeEntry
, Statement.ScopeExit , Statement.ScopeExit
, Statement.Try , Statement.Try
, Statement.Undef
, Statement.While , Statement.While
, Statement.Yield , Statement.Yield
, Syntax.Empty , Syntax.Empty
@ -223,10 +221,12 @@ comment :: Assignment
comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source)
alias :: Assignment alias :: Assignment
alias = makeTerm <$> symbol Alias <*> children (Statement.Alias <$> methodName <*> methodName) alias = makeTerm <$> symbol Alias <*> children (Expression.Call <$> name <*> some methodName)
where name = makeTerm <$> location <*> (Syntax.Identifier <$> source)
undef :: Assignment undef :: Assignment
undef = makeTerm <$> symbol Undef <*> children (Statement.Undef <$> some methodName) undef = makeTerm <$> symbol Undef <*> children (Expression.Call <$> name <*> some methodName)
where name = makeTerm <$> location <*> (Syntax.Identifier <$> source)
if' :: Assignment if' :: Assignment
if' = if' =