1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00

Rename __semantic_self to __self

This commit is contained in:
joshvera 2018-12-13 18:14:13 -05:00
parent 5630430b61
commit 4afe93a97d
7 changed files with 23 additions and 12 deletions

View File

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

View File

@ -6,7 +6,7 @@ module Data.Abstract.Name
, name
, nameI
, formatName
, __semantic_self
, __self
) where
import Control.Effect
@ -72,5 +72,5 @@ instance ToJSON Name where
toJSON = toJSON . formatName
toEncoding = toEncoding . formatName
__semantic_self :: Name
__semantic_self = name "__self"
__self :: Name
__self = name "__self"

View File

@ -111,7 +111,7 @@ instance ( FreeVariables term
withScopeAndFrame frameAddress $ do
case maybeThis of
Just object -> do
maybeSlot <- maybeLookupDeclaration (Declaration __semantic_self)
maybeSlot <- maybeLookupDeclaration (Declaration __self)
maybe (pure ()) (`assign` object) maybeSlot
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 (__semantic_self)
import Data.Abstract.Name (__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)
@ -92,7 +92,7 @@ instance Evaluatable Method where
params <- withScope associatedScope $ do
-- TODO: Should we give `self` a special Relation?
declare (Declaration __semantic_self) Default emptySpan Nothing
declare (Declaration __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,5 +701,5 @@ instance Ord1 This where liftCompare = genericLiftCompare
instance Show1 This where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable This where
eval _ _ This = do
reference (Reference __semantic_self) (Declaration __semantic_self)
deref =<< lookupDeclaration (Declaration __semantic_self)
reference (Reference __self) (Declaration __self)
deref =<< lookupDeclaration (Declaration __self)

View File

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

View File

@ -1,4 +1,15 @@
import { Adder } from "./class2"
class Adder {
summand: number;
constructor(summand: number) {
this.summand = summand;
}
addOne() {
this.summand += 1;
return this.summand;
}
}
var foo = new Adder(5)
foo.add()
foo.addOne()