1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Replace instances of name "__self" with __semantic_self

This commit is contained in:
Rick Winfrey 2018-12-13 11:33:55 -08:00
parent 0c22d4da4b
commit d0a571e851
5 changed files with 7 additions and 9 deletions

View File

@ -172,7 +172,7 @@ defineSelf :: ( AbstractValue term address value m
)
=> Evaluator term address value m ()
defineSelf = do
let self = Declaration $ X.name "__self"
let self = Declaration X.__semantic_self
-- TODO: Should `self` be given a special Relation?
declare self Default emptySpan Nothing
slot <- lookupDeclaration self

View File

@ -111,7 +111,7 @@ instance ( FreeVariables term
withScopeAndFrame frameAddress $ do
case maybeThis of
Just object -> do
slot <- lookupDeclaration (Declaration $ name "__self")
slot <- lookupDeclaration (Declaration __semantic_self)
assign slot object
Nothing -> pure ()
for_ (zip names params) $ \(name, param) -> do

View File

@ -13,7 +13,7 @@ import Prologue
import Proto3.Suite.Class
import Reprinting.Tokenize hiding (Superclass)
import Data.Span (emptySpan)
import Data.Abstract.Name as Name
import Data.Abstract.Name (__semantic_self)
data Function a = Function { functionContext :: ![a], functionName :: !a, functionParameters :: ![a], functionBody :: !a }
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, ToJSONFields1, Named1, Message1, NFData1)
@ -91,9 +91,8 @@ instance Evaluatable Method where
associatedScope <- declareFunction name span
params <- withScope associatedScope $ do
let self = Name.name "__self"
-- TODO: Should we give `self` a special Relation?
declare (Declaration self) Default emptySpan Nothing
declare (Declaration __semantic_self) Default emptySpan Nothing
for methodParameters $ \paramNode -> do
param <- maybeM (throwEvalError $ NoNameError paramNode) (declaredName paramNode)
param <$ declare (Declaration param) Default span Nothing

View File

@ -701,6 +701,5 @@ instance Ord1 This where liftCompare = genericLiftCompare
instance Show1 This where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable This where
eval _ _ This = do
let name = Name.name "__self"
reference (Reference name) (Declaration name)
deref =<< lookupDeclaration (Declaration name)
reference (Reference __semantic_self) (Declaration __semantic_self)
deref =<< lookupDeclaration (Declaration __semantic_self)

View File

@ -76,7 +76,7 @@ instance Evaluatable Send where
Nothing ->
pure (Name.name "call")
let self = lookupDeclaration (Declaration $ Name.name "__self") >>= deref
let self = lookupDeclaration (Declaration __semantic_self) >>= deref
lhsValue <- maybe self eval sendReceiver
lhsFrame <- Abstract.scopedEnvironment lhsValue