1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

Rename to just File

This commit is contained in:
Timothy Clem 2018-04-27 07:48:47 -07:00
parent 2d74919599
commit 5c8be10bd5
2 changed files with 9 additions and 8 deletions

View File

@ -7,12 +7,13 @@ import qualified Data.ByteString.Char8 as BC
import Diffing.Algorithm
import Prologue
data FileDirective a = FileDirective
-- A file directive like the Ruby constant `__FILE__`.
data File a = File
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1, Declarations1)
instance Eq1 FileDirective where liftEq = genericLiftEq
instance Ord1 FileDirective where liftCompare = genericLiftCompare
instance Show1 FileDirective where liftShowsPrec = genericLiftShowsPrec
instance Eq1 File where liftEq = genericLiftEq
instance Ord1 File where liftCompare = genericLiftCompare
instance Show1 File where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable FileDirective where
eval FileDirective{} = currentModule >>= string . BC.pack . modulePath
instance Evaluatable File where
eval File = currentModule >>= string . BC.pack . modulePath

View File

@ -29,7 +29,7 @@ type Syntax = '[
Comment.Comment
, Declaration.Function
, Declaration.Method
, Directive.FileDirective
, Directive.File
, Expression.Arithmetic
, Expression.Bitwise
, Expression.Boolean
@ -180,7 +180,7 @@ identifier =
vcallOrLocal = do
(loc, ident, locals) <- identWithLocals
case ident of
"__FILE__" -> pure $ makeTerm loc Directive.FileDirective
"__FILE__" -> pure $ makeTerm loc Directive.File
_ -> do
let identTerm = makeTerm loc (Syntax.Identifier (name ident))
if ident `elem` locals