1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Merge branch 'master' into fix-fix

This commit is contained in:
Rob Rix 2018-03-14 10:24:20 -04:00
commit 53e582fe8a
150 changed files with 922 additions and 1996 deletions

View File

@ -16,7 +16,7 @@ library
exposed-modules:
-- Analyses & term annotations
Analysis.Abstract.Caching
-- , Analysis.Abstract.Collecting
, Analysis.Abstract.Collecting
, Analysis.Abstract.Dead
, Analysis.Abstract.Evaluating
, Analysis.Abstract.Tracing
@ -38,7 +38,6 @@ library
, Control.Effect
-- Effects used for program analysis
, Control.Monad.Effect.Fresh
-- , Control.Monad.Effect.GC
, Control.Monad.Effect.NonDet
-- Datatypes for abstract interpretation
, Data.Abstract.Address
@ -161,6 +160,7 @@ library
, recursion-schemes
, reducers
, scientific
, semigroupoids
, split
, stm-chans
, template-haskell

View File

@ -1,49 +1,78 @@
{-# LANGUAGE ScopedTypeVariables #-}
module Analysis.Abstract.Collecting where
{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving, MultiParamTypeClasses, StandaloneDeriving, TypeFamilies, TypeOperators, UndecidableInstances #-}
module Analysis.Abstract.Collecting
( type Collecting
) where
import Prologue
import Control.Abstract.Evaluator
import Control.Monad.Effect.GC
import Control.Abstract.Analysis
import Data.Abstract.Address
import Data.Abstract.Configuration
import Data.Abstract.Live
import Data.Abstract.Store
import Data.Abstract.Value
import Prologue
newtype Collecting m term value (effects :: [* -> *]) a = Collecting (m term value effects a)
deriving (Alternative, Applicative, Functor, Effectful, Monad, MonadFail, MonadFresh, MonadNonDet)
deriving instance MonadEnvironment value (m term value effects) => MonadEnvironment value (Collecting m term value effects)
deriving instance MonadStore value (m term value effects) => MonadStore value (Collecting m term value effects)
deriving instance MonadModuleTable term value (m term value effects) => MonadModuleTable term value (Collecting m term value effects)
instance ( Effectful (m term value)
, Member (Reader (Live (LocationFor value) value)) effects
, MonadEvaluator term value (m term value effects)
)
=> MonadEvaluator term value (Collecting m term value effects) where
getConfiguration term = Configuration term <$> askRoots <*> askLocalEnv <*> getStore
instance ( Effectful (m term value)
, Foldable (Cell (LocationFor value))
, Member (Reader (Live (LocationFor value) value)) effects
, MonadAnalysis term value (m term value effects)
, Ord (LocationFor value)
, ValueRoots value
)
=> MonadAnalysis term value (Collecting m term value effects) where
type RequiredEffects term value (Collecting m term value effects)
= Reader (Live (LocationFor value) value)
': RequiredEffects term value (m term value effects)
-- Small-step evaluation which garbage-collects any non-rooted addresses after evaluating each term.
analyzeTerm term = do
roots <- askRoots
v <- liftAnalyze analyzeTerm term
modifyStore (gc (roots <> valueRoots v))
pure v
-- | Retrieve the local 'Live' set.
askRoots :: (Effectful m, Member (Reader (Live (LocationFor value) value)) effects) => m effects (Live (LocationFor value) value)
askRoots = raise ask
-- | Run a computation with the given 'Live' set added to the local root set.
-- extraRoots :: (Effectful m, Member (Reader (Live (LocationFor value) value)) effects, Ord (LocationFor value)) => Live (LocationFor value) value -> m effects a -> m effects a
-- extraRoots roots = raise . local (<> roots) . lower
-- | Small-step evaluation which garbage-collects any non-rooted addresses after evaluating each term.
evCollect :: forall t v m
. ( Ord (LocationFor v)
, Foldable (Cell (LocationFor v))
, MonadEvaluator t v m
, MonadGC v m
, ValueRoots (LocationFor v) v
)
=> (((v -> m v) -> t -> m v) -> (v -> m v) -> t -> m v)
-> ((v -> m v) -> t -> m v)
-> (v -> m v) -> t -> m v
evCollect ev0 ev' yield e = do
roots <- askRoots :: m (Live (LocationFor v) v)
v <- ev0 ev' yield e
modifyStore (gc (roots <> valueRoots v))
pure v
-- | Collect any addresses in the store not rooted in or reachable from the given 'Live' set.
gc :: ( Ord (LocationFor a)
, Foldable (Cell (LocationFor a))
, ValueRoots (LocationFor a) a
gc :: ( Ord (LocationFor value)
, Foldable (Cell (LocationFor value))
, ValueRoots value
)
=> Live (LocationFor a) a -- ^ The set of addresses to consider rooted.
-> Store (LocationFor a) a -- ^ A store to collect unreachable addresses within.
-> Store (LocationFor a) a -- ^ A garbage-collected store.
=> LiveFor value -- ^ The set of addresses to consider rooted.
-> StoreFor value -- ^ A store to collect unreachable addresses within.
-> StoreFor value -- ^ A garbage-collected store.
gc roots store = storeRestrict store (reachable roots store)
-- | Compute the set of addresses reachable from a given root set in a given store.
reachable :: ( Ord (LocationFor a)
, Foldable (Cell (LocationFor a))
, ValueRoots (LocationFor a) a
reachable :: ( Ord (LocationFor value)
, Foldable (Cell (LocationFor value))
, ValueRoots value
)
=> Live (LocationFor a) a -- ^ The set of root addresses.
-> Store (LocationFor a) a -- ^ The store to trace addresses through.
-> Live (LocationFor a) a -- ^ The set of addresses reachable from the root set.
=> LiveFor value -- ^ The set of root addresses.
-> StoreFor value -- ^ The store to trace addresses through.
-> LiveFor value -- ^ The set of addresses reachable from the root set.
reachable roots store = go mempty roots
where go seen set = case liveSplit set of
Nothing -> seen

View File

@ -14,6 +14,7 @@ import Control.Monad.Effect.Reader
import Control.Monad.Effect.State
import Data.Abstract.Configuration
import Data.Abstract.Evaluatable
import Data.Abstract.Address
import Data.Abstract.ModuleTable
import Data.Abstract.Value
import Data.Blob
@ -25,28 +26,30 @@ import Prologue
import System.FilePath.Posix
-- | Evaluate a term to a value.
evaluate :: forall value term
. ( Evaluatable (Base term)
evaluate :: forall value term effects
. ( effects ~ RequiredEffects term value (Evaluating term value effects)
, Evaluatable (Base term)
, FreeVariables term
, MonadAddressable (LocationFor value) value (Evaluating term value (EvaluatingEffects term value))
, MonadValue term value (Evaluating term value (EvaluatingEffects term value))
, MonadAddressable (LocationFor value) value (Evaluating term value effects)
, MonadValue term value (Evaluating term value effects)
, Recursive term
)
=> term
-> Final (EvaluatingEffects term value) value
-> Final effects value
evaluate = runAnalysis @(Evaluating term value) . evaluateModule
-- | Evaluate terms and an entry point to a value.
evaluates :: forall value term
. ( Evaluatable (Base term)
evaluates :: forall value term effects
. ( effects ~ RequiredEffects term value (Evaluating term value effects)
, Evaluatable (Base term)
, FreeVariables term
, MonadAddressable (LocationFor value) value (Evaluating term value (EvaluatingEffects term value))
, MonadValue term value (Evaluating term value (EvaluatingEffects term value))
, MonadAddressable (LocationFor value) value (Evaluating term value effects)
, MonadValue term value (Evaluating term value effects)
, Recursive term
)
=> [(Blob, term)] -- List of (blob, term) pairs that make up the program to be evaluated
-> (Blob, term) -- Entrypoint
-> Final (EvaluatingEffects term value) value
-> Final effects value
evaluates pairs (b, t) = runAnalysis @(Evaluating term value) (withModules b pairs (evaluateModule t))
-- | Run an action with the passed ('Blob', @term@) pairs available for imports.
@ -76,11 +79,18 @@ type EvaluatingEffects term value
, State (StoreFor value) -- The heap
, Reader (ModuleTable term) -- Cache of unevaluated modules
, State (ModuleTable (EnvironmentFor value)) -- Cache of evaluated modules
, State (Map Name (Name, Maybe (Address (LocationFor value) value))) -- Set of exports
]
instance Members '[Reader (EnvironmentFor value), State (EnvironmentFor value)] effects => MonadEnvironment value (Evaluating term value effects) where
instance Members '[State (Map Name (Name, Maybe (Address (LocationFor value) value))), Reader (EnvironmentFor value), State (EnvironmentFor value)] effects => MonadEnvironment value (Evaluating term value effects) where
getGlobalEnv = raise get
putGlobalEnv = raise . put
withGlobalEnv s = raise . localState s . lower
addExport key = raise . modify . Map.insert key
getExports = raise get
withExports s = raise . localState s . lower
askLocalEnv = raise ask
localEnv f a = raise (local f (lower a))

View File

@ -8,7 +8,8 @@ import Control.Monad.Effect.Writer
import Data.Abstract.Configuration
import Data.Abstract.Value
import Data.Semigroup.Reducer as Reducer
import Prologue
import Data.Union
import Prologue hiding (trace)
-- | Trace analysis.
--

View File

@ -147,9 +147,10 @@ instance CustomHasDeclaration (Union fs) Declaration.WildcardImport where
stripQuotes = T.dropAround (`elem` ['"', '\''])
getSource = toText . flip Source.slice blobSource . getField
instance (Expression.MemberAccess :< fs) => CustomHasDeclaration (Union fs) Expression.Call where
instance (Syntax.Identifier :< fs, Expression.MemberAccess :< fs) => CustomHasDeclaration (Union fs) Expression.Call where
customToDeclaration Blob{..} _ (Expression.Call _ (Term (In fromAnn fromF), _) _ _)
| Just (Expression.MemberAccess (Term (In leftAnn leftF)) (Term (In idenAnn _))) <- prj fromF = Just $ CallReference (getSource idenAnn) (memberAccess leftAnn leftF)
| Just (Syntax.Identifier name) <- prj fromF = Just $ CallReference (T.decodeUtf8 (friendlyName name)) []
| otherwise = Just $ CallReference (getSource fromAnn) []
where
memberAccess modAnn termFOut

View File

@ -2,6 +2,8 @@
module Control.Abstract.Analysis
( MonadAnalysis(..)
, evaluateTerm
, require
, load
, liftAnalyze
, runAnalysis
, module X
@ -17,7 +19,12 @@ import Control.Monad.Effect.Fresh as X
import Control.Monad.Effect.NonDet as X
import Control.Monad.Effect.Reader as X
import Control.Monad.Effect.State as X
import Data.Abstract.Environment
import Data.Abstract.ModuleTable
import Data.Abstract.Value
import Data.Coerce
import qualified Data.Map as Map
import Prelude hiding (fail)
import Prologue
-- | A 'Monad' in which one can evaluate some specific term type to some specific value type.
@ -41,6 +48,38 @@ evaluateTerm :: MonadAnalysis term value m => term -> m value
evaluateTerm = foldSubterms analyzeTerm
-- | Require/import another term/file and return an Effect.
--
-- Looks up the term's name in the cache of evaluated modules first, returns a value if found, otherwise loads/evaluates the module.
require :: ( MonadAnalysis term value m
, Ord (LocationFor value)
)
=> ModuleName
-> m (EnvironmentFor value)
require name = getModuleTable >>= maybe (load name) pure . moduleTableLookup name
-- | Load another term/file and return an Effect.
--
-- Always loads/evaluates.
load :: ( MonadAnalysis term value m
, Ord (LocationFor value)
)
=> ModuleName
-> m (EnvironmentFor value)
load name = askModuleTable >>= maybe notFound evalAndCache . moduleTableLookup name
where notFound = fail ("cannot load module: " <> show name)
evalAndCache e = do
void $ evaluateModule e
-- TODO: If the set of exports is empty because no exports have been
-- defined, do we export all terms, or no terms? This behavior varies across
-- languages. We need better semantics rather than doing it ad-hoc.
env <- getGlobalEnv
exports <- getExports
let env' = if Map.null exports then env else bindExports exports env
modifyModuleTable (moduleTableInsert name env')
pure env'
-- | Lift a 'SubtermAlgebra' for an underlying analysis into a containing analysis. Use this when defining an analysis which can be composed onto other analyses to ensure that a call to 'analyzeTerm' occurs in the inner analysis and not the outer one.
liftAnalyze :: ( Coercible ( m term value (effects :: [* -> *]) value) (t m term value effects value)
, Coercible (t m term value effects value) ( m term value effects value)

View File

@ -12,6 +12,7 @@ module Control.Abstract.Evaluator
import Data.Abstract.Address
import Data.Abstract.Configuration
import Data.Abstract.FreeVariables
import Data.Abstract.ModuleTable
import Data.Abstract.Store
import Data.Abstract.Value
@ -40,6 +41,14 @@ class Monad m => MonadEnvironment value m | m -> value where
getGlobalEnv :: m (EnvironmentFor value)
-- | Set the global environment
putGlobalEnv :: EnvironmentFor value -> m ()
withGlobalEnv :: EnvironmentFor value -> m a -> m a
-- | Add an export to the global export state.
addExport :: Name -> (Name, Maybe (Address (LocationFor value) value)) -> m ()
-- | Get the global export state.
getExports :: m (Map Name (Name, Maybe (Address (LocationFor value) value)))
-- | Sets the exports state to the given map for the lifetime of the given action.
withExports :: Map Name (Name, Maybe (Address (LocationFor value) value)) -> m a -> m a
-- | Retrieve the local environment.
askLocalEnv :: m (EnvironmentFor value)

View File

@ -59,9 +59,6 @@ class (MonadAnalysis term value m, Show value) => MonadValue term value m where
-- | Construct an N-ary tuple of multiple (possibly-disjoint) values
multiple :: [value] -> m value
-- | Construct an abstract interface value.
interface :: value -> m value
-- | Eliminate boolean values. TODO: s/boolean/truthy
ifthenelse :: value -> m a -> m a -> m a
@ -70,9 +67,6 @@ class (MonadAnalysis term value m, Show value) => MonadValue term value m where
-- | Evaluate an application (like a function call).
apply :: value -> [Subterm term (m value)] -> m value
-- | Extract the environment from an interface value.
environment :: value -> m (EnvironmentFor value)
-- | Attempt to extract a 'Prelude.Bool' from a given value.
toBool :: MonadValue term value m => value -> m Bool
toBool v = ifthenelse v (pure True) (pure False)
@ -124,8 +118,6 @@ instance ( MonadAddressable location (Value location term) m
multiple vals =
pure . injValue $ Value.Tuple vals
interface v = injValue . Value.Interface v <$> getGlobalEnv
ifthenelse cond if' else'
| Just (Boolean b) <- prjValue cond = if b then if' else else'
| otherwise = fail ("not defined for non-boolean conditions: " <> show cond)
@ -184,10 +176,6 @@ instance ( MonadAddressable location (Value location term) m
envInsert name a <$> rest) (pure env) (zip names params)
localEnv (mappend bindings) (evaluateTerm body)
environment v
| Just (Interface _ env) <- prjValue v = pure env
| otherwise = pure mempty
-- | Discard the value arguments (if any), constructing a 'Type.Type' instead.
instance (Alternative m, MonadAnalysis term Type m, MonadFresh m) => MonadValue term Type m where
abstract names (Subterm _ body) = do
@ -206,8 +194,6 @@ instance (Alternative m, MonadAnalysis term Type m, MonadFresh m) => MonadValue
string _ = pure Type.String
float _ = pure Type.Float
multiple = pure . Type.Product
-- TODO
interface = undefined
ifthenelse cond if' else' = unify cond Bool *> (if' <|> else')
@ -227,6 +213,3 @@ instance (Alternative m, MonadAnalysis term Type m, MonadFresh m) => MonadValue
paramTypes <- traverse subtermValue params
_ :-> ret <- op `unify` (Product paramTypes :-> Var tvar)
pure ret
-- TODO
environment = undefined

View File

@ -1,21 +0,0 @@
{-# LANGUAGE MultiParamTypeClasses, ScopedTypeVariables, TypeOperators, UndecidableInstances #-}
module Control.Monad.Effect.GC where
import Prologue
import Control.Monad.Effect
import Control.Monad.Effect.Reader
import Data.Abstract.Live
import Data.Abstract.Value
-- | 'Monad's offering a local set of 'Live' (rooted/reachable) addresses.
class Monad m => MonadGC a m where
-- | Retrieve the local 'Live' set.
askRoots :: m (Live (LocationFor a) a)
-- | Run a computation with the given 'Live' set added to the local root set.
extraRoots :: Live (LocationFor a) a -> m b -> m b
instance (Ord (LocationFor a), Reader (Live (LocationFor a) a) :< fs) => MonadGC a (Eff fs) where
askRoots = ask :: Eff fs (Live (LocationFor a) a)
extraRoots roots' = local (<> roots')

View File

@ -1,4 +1,4 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses, StandaloneDeriving #-}
module Data.Abstract.Environment where
import Prologue
@ -6,12 +6,15 @@ import Data.Abstract.Address
import Data.Abstract.FreeVariables
import Data.Abstract.Live
import qualified Data.Map as Map
import Data.Semigroup.Reducer
import qualified Data.Set as Set
-- | A map of names to addresses that represents the evaluation environment.
newtype Environment l a = Environment { unEnvironment :: Map.Map Name (Address l a) }
deriving (Eq, Foldable, Functor, Generic1, Monoid, Ord, Semigroup, Show, Traversable)
deriving instance Reducer (Name, Address l a) (Environment l a)
-- | Lookup a 'Name' in the environment.
envLookup :: Name -> Environment l a -> Maybe (Address l a)
envLookup k = Map.lookup k . unEnvironment
@ -20,12 +23,15 @@ envLookup k = Map.lookup k . unEnvironment
envInsert :: Name -> Address l a -> Environment l a -> Environment l a
envInsert name value (Environment m) = Environment (Map.insert name value m)
envUnion :: Environment l a -> Environment l a -> Environment l a
envUnion (Environment e1) (Environment e2) = Environment $ Map.union e1 e2
bindEnv :: (Ord l, Foldable t) => t Name -> Environment l a -> Environment l a
bindEnv names env = Environment (Map.fromList pairs)
where pairs = foldr (\name b -> maybe b (\v -> (name, v) : b) (envLookup name env)) mempty names
bindEnv names env = foldMap envForName names
where envForName name = maybe mempty (curry unit name) (envLookup name env)
bindExports :: (Ord l) => Map Name (Name, Maybe (Address l a)) -> Environment l a -> Environment l a
bindExports aliases env = Environment pairs
where
pairs = Map.foldrWithKey (\name (alias, address) accum ->
maybe accum (\v -> Map.insert alias v accum) (address <|> envLookup name env)) mempty aliases
-- | Retrieve the 'Live' set of addresses to which the given free variable names are bound.
--

View File

@ -6,20 +6,16 @@ module Data.Abstract.Evaluatable
, module FreeVariables
, module Value
, MonadEvaluator(..)
, require
, load
) where
import Control.Abstract.Addressable as Addressable
import Control.Abstract.Analysis as Analysis
import Control.Abstract.Value as Value
import Data.Abstract.Environment
import Data.Abstract.FreeVariables as FreeVariables
import Data.Abstract.ModuleTable
import Data.Abstract.Value
import Data.Functor.Classes
import Data.Proxy
import Data.Semigroup
import Data.Semigroup.Foldable
import Data.Term
import Prelude hiding (fail)
import Prologue
@ -42,7 +38,7 @@ instance Apply Evaluatable fs => Evaluatable (Union fs) where
-- | Evaluating a 'TermF' ignores its annotation, evaluating the underlying syntax.
instance Evaluatable s => Evaluatable (TermF s a) where
eval In{..} = eval termFOut
eval = eval . termFOut
-- Instances
@ -53,42 +49,17 @@ instance Evaluatable s => Evaluatable (TermF s a) where
-- 2. Each statement can affect the environment of later statements (e.g. by 'modify'-ing the environment); and
-- 3. Only the last statements return value is returned.
instance Evaluatable [] where
eval [] = unit -- Return unit value if this is an empty list of terms
eval [x] = subtermValue x -- Return the value for the last term
eval (x:xs) = do
_ <- subtermValue x -- Evaluate the head term
env <- getGlobalEnv -- Get the global environment after evaluation
-- since it might have been modified by the
-- evaluation above ^.
-- 'nonEmpty' and 'foldMap1' enable us to return the last statements result instead of 'unit' for non-empty lists.
eval = maybe unit (runImperative . foldMap1 (Imperative . subtermValue)) . nonEmpty
-- Finally, evaluate the rest of the terms, but do so by calculating a new
-- environment each time where the free variables in those terms are bound
-- to the global environment.
localEnv (const (bindEnv (liftFreeVariables (freeVariables . subterm) xs) env)) (eval xs)
-- | A 'Semigroup' providing an imperative context which extends the local environment with new bindings.
newtype Imperative m a = Imperative { runImperative :: m a }
instance MonadEnvironment value m => Semigroup (Imperative m a) where
Imperative a <> Imperative b = Imperative $ a *> do
env <- getGlobalEnv
localEnv (<> env) b
-- | Require/import another term/file and return an Effect.
--
-- Looks up the term's name in the cache of evaluated modules first, returns a value if found, otherwise loads/evaluates the module.
require :: ( MonadAnalysis term value m
, MonadValue term value m
)
=> ModuleName
-> m (EnvironmentFor value)
require name = getModuleTable >>= maybe (load name) pure . moduleTableLookup name
-- | Load another term/file and return an Effect.
--
-- Always loads/evaluates.
load :: ( MonadAnalysis term value m
, MonadValue term value m
)
=> ModuleName
-> m (EnvironmentFor value)
load name = askModuleTable >>= maybe notFound evalAndCache . moduleTableLookup name
where notFound = fail ("cannot load module: " <> show name)
evalAndCache e = do
v <- evaluateModule e
env <- environment v
modifyModuleTable (moduleTableInsert name env)
pure env
instance MonadValue term value m => Monoid (Imperative m value) where
mempty = Imperative unit
mappend = (<>)

View File

@ -39,7 +39,9 @@ freeVariables1 :: (FreeVariables1 t, FreeVariables a) => t a -> Set Name
freeVariables1 = liftFreeVariables freeVariables
freeVariable :: FreeVariables term => term -> Name
freeVariable term = let [n] = toList (freeVariables term) in n
freeVariable term = case toList (freeVariables term) of
[n] -> n
xs -> Prelude.fail ("expected single free variable, but got: " <> show xs)
-- TODO: Need a dedicated concept of qualified names outside of freevariables (a
-- Set) b/c you can have something like `a.a.b.a`

View File

@ -10,12 +10,11 @@ import qualified Data.Abstract.Type as Type
import qualified Data.Set as Set
import Data.Scientific (Scientific)
import Prologue
import Prelude hiding (Float, Integer, String, fail)
import Prelude hiding (Float, Integer, String)
import qualified Prelude
type ValueConstructors location term
= '[Closure location term
, Interface location
, Unit
, Boolean
, Float
@ -54,14 +53,6 @@ instance (Eq location, Eq term) => Eq1 (Closure location term) where liftEq = ge
instance (Ord location, Ord term) => Ord1 (Closure location term) where liftCompare = genericLiftCompare
instance (Show location, Show term) => Show1 (Closure location term) where liftShowsPrec = genericLiftShowsPrec
-- | A program value consisting of the value of the program and it's enviornment of bindings.
data Interface location value = Interface value (Environment location value)
deriving (Eq, Generic1, Ord, Show)
instance (Eq location) => Eq1 (Interface location) where liftEq = genericLiftEq
instance (Ord location) => Ord1 (Interface location) where liftCompare = genericLiftCompare
instance (Show location) => Show1 (Interface location) where liftShowsPrec = genericLiftShowsPrec
-- | The unit value. Typically used to represent the result of imperative statements.
data Unit value = Unit
deriving (Eq, Generic1, Ord, Show)
@ -122,20 +113,23 @@ type StoreFor v = Store (LocationFor v) v
-- | The cell for an abstract value type.
type CellFor value = Cell (LocationFor value) value
-- | The address set type for an abstract value type.
type LiveFor value = Live (LocationFor value) value
-- | The location type (the body of 'Address'es) which should be used for an abstract value type.
type family LocationFor value :: * where
LocationFor (Value location term) = location
LocationFor Type.Type = Monovariant
-- | Value types, e.g. closures, which can root a set of addresses.
class ValueRoots l v | v -> l where
class ValueRoots value where
-- | Compute the set of addresses rooted by a given value.
valueRoots :: v -> Live l v
valueRoots :: value -> LiveFor value
instance (FreeVariables term, Ord location) => ValueRoots location (Value location term) where
instance (FreeVariables term, Ord location) => ValueRoots (Value location term) where
valueRoots v
| Just (Closure names body env) <- prjValue v = envRoots env (foldr Set.delete (freeVariables (body :: term)) names)
| otherwise = mempty
instance ValueRoots Monovariant Type.Type where
instance ValueRoots Type.Type where
valueRoots _ = mempty

View File

@ -124,14 +124,8 @@ instance Ord1 Program where liftCompare = genericLiftCompare
instance Show1 Program where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Program where
eval (Program xs) = eval' xs
where
eval' [] = unit >>= interface
eval' [x] = subtermValue x >>= interface
eval' (x:xs) = do
_ <- subtermValue x
env <- getGlobalEnv
localEnv (envUnion env) (eval' xs)
eval (Program xs) = do
withExports mempty (eval xs)
-- | An accessibility modifier, e.g. private, public, protected, etc.
newtype AccessibilityModifier a = AccessibilityModifier ByteString

View File

@ -161,14 +161,7 @@ instance Show1 Module where liftShowsPrec = genericLiftShowsPrec
-- We need to ensure that all input files have aggregated their content into
-- a coherent module before we begin evaluating a module.
instance Evaluatable Module where
eval (Module _ xs) = eval' xs
where
eval' [] = unit >>= interface
eval' [x] = subtermValue x >>= interface
eval' (x:xs) = do
_ <- subtermValue x
env <- getGlobalEnv
localEnv (envUnion env) (eval' xs)
eval (Module _ xs) = eval xs
-- | A decorator in Python
data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a }
@ -219,6 +212,39 @@ instance Show1 Comprehension where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Comprehension
instance Evaluatable Comprehension
-- | Qualified Export declarations
newtype QualifiedExport a = QualifiedExport { qualifiedExportSymbols :: [(Name, Name)] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 QualifiedExport where liftEq = genericLiftEq
instance Ord1 QualifiedExport where liftCompare = genericLiftCompare
instance Show1 QualifiedExport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedExport where
eval (QualifiedExport exportSymbols) = do
-- Insert the aliases with no addresses.
for_ exportSymbols $ \(name, alias) ->
addExport name (alias, Nothing)
unit
-- | Qualified Export declarations that export from another module.
data QualifiedExportFrom a = QualifiedExportFrom { qualifiedExportFrom :: !a, qualifiedExportFromSymbols :: ![(Name, Name)]}
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 QualifiedExportFrom where liftEq = genericLiftEq
instance Ord1 QualifiedExportFrom where liftCompare = genericLiftCompare
instance Show1 QualifiedExportFrom where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedExportFrom where
eval (QualifiedExportFrom from exportSymbols) = do
let moduleName = freeVariable (subterm from)
importedEnv <- withGlobalEnv mempty (require moduleName)
-- Look up addresses in importedEnv and insert the aliases with addresses into the exports.
for_ exportSymbols $ \(name, alias) -> do
let address = Map.lookup name (unEnvironment importedEnv)
addExport name (alias, address)
unit
-- | Qualified Import declarations (symbols are qualified in calling environment).
data QualifiedImport a = QualifiedImport { qualifiedImportFrom :: !a, qualifiedImportAlias :: !a, qualifiedImportSymbols :: ![(Name, Name)]}
@ -230,23 +256,29 @@ instance Show1 QualifiedImport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedImport where
eval (QualifiedImport from alias xs) = do
env <- getGlobalEnv
putGlobalEnv mempty
importedEnv <- require (freeVariable (subterm from))
env' <- Map.foldrWithKey copy (pure env) (unEnvironment importedEnv)
modifyGlobalEnv (const env')
importedEnv <- withGlobalEnv mempty (require (freeVariable (subterm from)))
modifyGlobalEnv (flip (Map.foldrWithKey copy) (unEnvironment importedEnv))
unit
where
prefix = freeVariable (subterm alias)
symbols = Map.fromList xs
copy = if Map.null symbols then qualifyInsert else directInsert
qualifyInsert k v rest = envInsert (prefix <> k) v <$> rest
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v <$> rest) (Map.lookup k symbols)
qualifyInsert k v rest = envInsert (prefix <> k) v rest
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v rest) (Map.lookup k symbols)
newtype DefaultExport a = DefaultExport { defaultExport :: a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 DefaultExport where liftEq = genericLiftEq
instance Ord1 DefaultExport where liftCompare = genericLiftCompare
instance Show1 DefaultExport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable DefaultExport where
-- | Import declarations (symbols are added directly to the calling env).
--
-- If symbols is empty, just evaluate the module for it's side effects.
-- If symbols is empty, just import the module for its side effects.
data Import a = Import { importFrom :: !a, importSymbols :: ![(Name, Name)] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
@ -256,15 +288,12 @@ instance Show1 Import where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Import where
eval (Import from xs) = do
env <- getGlobalEnv
putGlobalEnv mempty
importedEnv <- require (freeVariable (subterm from))
env' <- Map.foldrWithKey directInsert (pure env) (unEnvironment importedEnv)
modifyGlobalEnv (const env')
importedEnv <- withGlobalEnv mempty (require (freeVariable (subterm from)))
modifyGlobalEnv (flip (Map.foldrWithKey directInsert) (unEnvironment importedEnv))
unit
where
symbols = Map.fromList xs
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v <$> rest) (Map.lookup k symbols)
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v rest) (Map.lookup k symbols)
-- | A wildcard import (all symbols are added directly to the calling env)
@ -278,7 +307,10 @@ instance Ord1 WildcardImport where liftCompare = genericLiftCompare
instance Show1 WildcardImport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable WildcardImport where
eval (WildcardImport from _) = putGlobalEnv mempty *> require (freeVariable (subterm from)) *> unit
eval (WildcardImport from _) = do -- require (freeVariable (subterm from)) *> putGlobalEnv mempty *> unit
importedEnv <- withGlobalEnv mempty (require (freeVariable (subterm from)))
modifyGlobalEnv (flip (Map.foldrWithKey envInsert) (unEnvironment importedEnv))
unit
-- | A declared type (e.g. `a []int` in Go).
data Type a = Type { typeName :: !a, typeKind :: !a }

View File

@ -390,7 +390,8 @@ importDeclaration = makeTerm'' <$> symbol ImportDeclaration <*> children (manyTe
<|> makeTerm <$> symbol ImportSpec <*> children namedImport
<|> makeTerm <$> symbol ImportSpec <*> children plainImport
dotImport = symbol Dot *> source *> (Declaration.WildcardImport <$> expression <*> emptyTerm)
dotImport = symbol Dot *> source >>= \s ->
Declaration.WildcardImport <$> expression <*> (makeTerm <$> location <*> pure (Syntax.Identifier (name s)))
sideEffectImport = symbol BlankIdentifier *> source *> (Declaration.Import <$> expression <*> pure [])
namedImport = symbol PackageIdentifier >>= \loc -> do
s <- source

View File

@ -7,12 +7,13 @@ module Language.TypeScript.Assignment
) where
import Assigning.Assignment hiding (Assignment, Error)
import qualified Assigning.Assignment as Assignment
import Data.Abstract.FreeVariables
import qualified Data.ByteString as B (filter)
import qualified Data.ByteString.Char8 as BC
import Data.Char (ord)
import Data.Record
import Data.Syntax (emptyTerm, handleError, parseError, infixContext, makeTerm, makeTerm', makeTerm'', makeTerm1, contextualize, postContextualize)
import Language.TypeScript.Grammar as Grammar
import Prologue
import qualified Assigning.Assignment as Assignment
import qualified Data.Syntax as Syntax
import qualified Data.Syntax.Comment as Comment
import qualified Data.Syntax.Declaration as Declaration
@ -21,7 +22,9 @@ import qualified Data.Syntax.Literal as Literal
import qualified Data.Syntax.Statement as Statement
import qualified Data.Syntax.Type as Type
import qualified Data.Term as Term
import Language.TypeScript.Grammar as Grammar
import qualified Language.TypeScript.Syntax as TypeScript.Syntax
import Prologue
-- | The type of TypeScript syntax.
type Syntax = '[
@ -36,6 +39,9 @@ type Syntax = '[
, Declaration.TypeAlias
, Declaration.Import
, Declaration.QualifiedImport
, Declaration.DefaultExport
, Declaration.QualifiedExport
, Declaration.QualifiedExportFrom
, Declaration.Module
, Expression.Arithmetic
, Expression.Bitwise
@ -156,8 +162,6 @@ type Syntax = '[
, TypeScript.Syntax.ImportRequireClause
, TypeScript.Syntax.ImportClause
, TypeScript.Syntax.LabeledStatement
, TypeScript.Syntax.NamedImports
, TypeScript.Syntax.NamespaceImport
, TypeScript.Syntax.Annotation
, TypeScript.Syntax.With
, TypeScript.Syntax.ForOf
@ -262,7 +266,12 @@ ternaryExpression :: Assignment
ternaryExpression = makeTerm <$> symbol Grammar.TernaryExpression <*> children (Statement.If <$> term expression <*> term expression <*> term expression)
memberExpression :: Assignment
memberExpression = makeTerm <$> (symbol Grammar.MemberExpression <|> symbol Grammar.MemberExpression') <*> children (Expression.MemberAccess <$> term expression <*> term propertyIdentifier)
memberExpression = (symbol Grammar.MemberExpression <|> symbol Grammar.MemberExpression') *> children (qualifiedIdentifier <|> memberAccess)
where
memberAccess = makeTerm <$> location <*> (Expression.MemberAccess <$> term expression <*> term propertyIdentifier)
qualifiedIdentifier = makeTerm <$> location <*> ((\a b -> Syntax.Identifier (qualifiedName [a, b])) <$> identifier' <*> propertyIdentifier')
identifier' = (symbol Identifier <|> symbol Identifier') *> source
propertyIdentifier' = symbol PropertyIdentifier *> source
newExpression :: Assignment
newExpression = makeTerm <$> symbol Grammar.NewExpression <*> children (Expression.New . pure <$> term expression)
@ -632,18 +641,21 @@ statementIdentifier :: Assignment
statementIdentifier = makeTerm <$> symbol StatementIdentifier <*> (Syntax.Identifier <$> (name <$> source))
importStatement :: Assignment
importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children ((,) <$> importClause <*> term string)
importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children ((,) <$> importClause <*> term path)
<|> makeImport <$> symbol Grammar.ImportStatement <*> children requireImport
<|> makeImport <$> symbol Grammar.ImportStatement <*> children bareRequireImport
where
-- Straightforward imports
makeImport loc (Just alias, symbols, from) = makeTerm loc (Declaration.QualifiedImport from alias symbols)
makeImport loc (Nothing, symbols, from) = makeTerm loc (Declaration.Import from symbols)
-- Import a file giving it an alias (e.g. import foo = require "./foo")
requireImport = symbol Grammar.ImportRequireClause *> children ((,,) <$> (Just <$> (term identifier)) <*> pure [] <*> term string)
requireImport = symbol Grammar.ImportRequireClause *> children ((,,) <$> (Just <$> (term identifier)) <*> pure [] <*> term path)
-- Import a file just for it's side effects (e.g. import "./foo")
bareRequireImport = (,,) <$> (pure Nothing) <*> pure [] <*> term string
bareRequireImport = (,,) <$> (pure Nothing) <*> pure [] <*> term path
path = makeTerm <$> symbol Grammar.String <*> (Syntax.Identifier <$> (qualifiedName' <$> source))
qualifiedName' = qualifiedName . BC.split '/' . (BC.dropWhile (== '/')) . (BC.dropWhile (== '.')) . stripQuotes
stripQuotes = B.filter (/= (fromIntegral (ord '\"')))
-- Imports with import clauses
makeImportTerm1 loc from (Prelude.True, Just alias, symbols) = makeTerm loc (Declaration.QualifiedImport from alias symbols)
@ -666,6 +678,10 @@ importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children
makeNameAliasPair from (Just alias) = (from, alias)
makeNameAliasPair from Nothing = (from, from)
stripQuotes :: ByteString -> ByteString
stripQuotes = B.filter (/= (fromIntegral (ord '\"')))
debuggerStatement :: Assignment
debuggerStatement = makeTerm <$> symbol Grammar.DebuggerStatement <*> (TypeScript.Syntax.Debugger <$ source)
@ -709,16 +725,21 @@ ambientDeclaration :: Assignment
ambientDeclaration = makeTerm <$> symbol Grammar.AmbientDeclaration <*> children (TypeScript.Syntax.AmbientDeclaration <$> term (choice [declaration, statementBlock]))
exportStatement :: Assignment
exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> children (TypeScript.Syntax.Export <$> (((\a b -> [a, b]) <$> term exportClause <*> term fromClause) <|> ((++) <$> manyTerm decorator <*> (pure <$> term (fromClause <|> exportClause <|> declaration <|> expression <|> identifier <|> importAlias')))))
exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> (children (flip Declaration.QualifiedExportFrom <$> exportClause <*> term fromClause))
<|> makeTerm <$> symbol Grammar.ExportStatement <*> children (Declaration.QualifiedExport <$> exportClause)
<|> makeTerm <$> symbol Grammar.ExportStatement <*> children (Declaration.DefaultExport <$> contextualize decorator (term (declaration <|> expression <|> identifier <|> importAlias')))
where
exportClause = symbol Grammar.ExportClause *> children (many exportSymbol)
exportSymbol = symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> (Just <$> rawIdentifier))
<|> symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> (pure Nothing))
makeNameAliasPair from (Just alias) = (from, alias)
makeNameAliasPair from Nothing = (from, from)
rawIdentifier = (symbol Identifier <|> symbol Identifier') *> (name <$> source)
-- <|> (makeExport2 <$> manyTerm decorator <*> emptyTerm <*> (pure <$> term (fromClause <|> exportClause <|> declaration <|> expression <|> identifier <|> importAlias')))))
-- makeExport2 decorators fromClause exportClause = Declaration.QualifiedExport fromClause exportClause
fromClause :: Assignment
fromClause = string
exportClause :: Assignment
exportClause = makeTerm <$> symbol Grammar.ExportClause <*> children (TypeScript.Syntax.ExportClause <$> manyTerm importExportSpecifier)
importExportSpecifier :: Assignment
importExportSpecifier = makeTerm <$> (symbol Grammar.ExportSpecifier <|> symbol Grammar.ImportSpecifier) <*> children (TypeScript.Syntax.ImportExportSpecifier <$> term identifier <*> (term identifier <|> emptyTerm))
fromClause = makeTerm <$> symbol Grammar.String <*> (Syntax.Identifier . name . stripQuotes <$> source)
propertySignature :: Assignment
propertySignature = makePropertySignature <$> symbol Grammar.PropertySignature <*> children ((,,,) <$> (term accessibilityModifier' <|> emptyTerm) <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm))

View File

@ -71,14 +71,6 @@ instance Ord1 ImportClause where liftCompare = genericLiftCompare
instance Show1 ImportClause where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImportClause
newtype NamespaceImport a = NamespaceImport { _namespaceImportSubject :: a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 NamespaceImport where liftEq = genericLiftEq
instance Ord1 NamespaceImport where liftCompare = genericLiftCompare
instance Show1 NamespaceImport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable NamespaceImport
newtype Tuple a = Tuple { _tupleElements :: [a] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
@ -241,14 +233,6 @@ instance Ord1 ImportExportSpecifier where liftCompare = genericLiftCompare
instance Show1 ImportExportSpecifier where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImportExportSpecifier
newtype NamedImports a = NamedImports { _namedImportElements :: [a] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 NamedImports where liftEq = genericLiftEq
instance Ord1 NamedImports where liftCompare = genericLiftCompare
instance Show1 NamedImports where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable NamedImports
data With a = With { _withExpression :: !a, _withBody :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)

View File

@ -23,6 +23,8 @@ import Data.List.NonEmpty as X (
, some1
)
import Debug.Trace as X
import Control.Exception as X hiding (
evaluate
, throw

View File

@ -9,13 +9,13 @@
->(Identifier) })
{+(WildcardImport
{+(TextElement)+}
{+(Empty)+})+}
{+(Identifier)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{-(WildcardImport
{-(TextElement)-}
{-(Empty)-})-}
{-(Identifier)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})

View File

@ -9,13 +9,13 @@
->(Identifier) })
{+(WildcardImport
{+(TextElement)+}
{+(Empty)+})+}
{+(Identifier)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{-(WildcardImport
{-(TextElement)-}
{-(Empty)-})-}
{-(Identifier)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})

View File

@ -7,7 +7,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)))

View File

@ -7,7 +7,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)))

View File

@ -9,7 +9,7 @@
(WildcardImport
{ (TextElement)
->(TextElement) }
(Empty))
(Identifier))
(QualifiedImport
{ (TextElement)
->(TextElement) }

View File

@ -9,7 +9,7 @@
(WildcardImport
{ (TextElement)
->(TextElement) }
(Empty))
(Identifier))
(QualifiedImport
{ (TextElement)
->(TextElement) }

View File

@ -6,7 +6,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier))

View File

@ -6,7 +6,7 @@
(Identifier))
(WildcardImport
(TextElement)
(Empty))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier))

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
{ (TextElement)
->(TextElement) }

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
{ (TextElement)
->(TextElement) }

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
(TextElement)
(Empty))))

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
(TextElement)
(Empty))))

View File

@ -3,6 +3,4 @@
{ (Subscript
{-(Identifier)-}
{-(TextElement)-})
->(MemberAccess
{+(Identifier)+}
{+(Identifier)+}) }))
->(Identifier) }))

View File

@ -1,8 +1,6 @@
(Program
(Delete
{ (MemberAccess
{-(Identifier)-}
{-(Identifier)-})
{ (Identifier)
->(Subscript
{+(Identifier)+}
{+(TextElement)+}) }))

View File

@ -1,5 +1,3 @@
(Program
(Delete
(MemberAccess
(Identifier)
(Identifier))))
(Identifier)))

View File

@ -4,9 +4,7 @@
->(Boolean) }
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))

View File

@ -4,9 +4,7 @@
->(Boolean) }
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))

View File

@ -3,8 +3,6 @@
(Boolean)
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))

View File

@ -3,8 +3,6 @@
(Boolean)
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))

View File

@ -1,161 +1,31 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(Export
(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
{ (Empty)
->(Identifier) })
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}))
(Export
{(QualifiedExport)->(QualifiedExport)}
{(QualifiedExport)->(QualifiedExport)}
(DefaultExport
(VariableDeclaration
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))))
(DefaultExport
(VariableDeclaration
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Identifier)-})-}
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
{ (Empty)
->(Identifier) })
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
{ (Identifier)
->(Identifier) })
{+(Export
{+(Function
{+(Empty)+}
{+(Empty)+}
{+(Identifier)+}
{+([])+})+})+}
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+})+}
{-(Function
{-(Empty)-}
{-(Empty)-}
{-(Identifier)-}
{-([])-})-})
(Export
{+(TextElement)+}
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-})-})
{+(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+})+}
{+(TextElement)+})+}
{+(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+})+}
{+(TextElement)+})+}
{-(Export
{-(TextElement)-})-}
{-(Export
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})-}
{-(TextElement)-})-}
{-(Export
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})-}
{-(TextElement)-})-})
{-(Assignment{-(Empty)-}{-(Identifier)-}{-(Identifier)-})-}
(Assignment(Empty)(Identifier)(Identifier))
(Assignment(Empty)(Identifier){(Empty)->(Identifier)})
{+(Assignment{+(Empty)+}{+(Identifier)+}{+(Empty)+})+}
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))))
(DefaultExport
{(Identifier)->(Identifier)})
{+(DefaultExport
{+(Function{+(Empty)+}{+(Empty)+}{+(Identifier)+}{+([])+})+})+}
(DefaultExport
(Function(Empty)(Empty)(Empty)([])))
{+(QualifiedExport)+}
{+(DefaultExport {+(TextElement)+})+}
{+(QualifiedExportFrom {+(Identifier)+})+}
{+(QualifiedExportFrom {+(Identifier)+})+}
{-(DefaultExport
{-(Function{-(Empty)-}{-(Empty)-}{-(Identifier)-}{-([])-})-})-}
{-(QualifiedExport)-}
{-(DefaultExport {-(TextElement)-})-}
{-(QualifiedExportFrom {-(Identifier)-})-}
{-(QualifiedExportFrom {-(Identifier)-})-})

View File

@ -1,153 +1,24 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(Export
(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Empty) })
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(Export
{(QualifiedExport)->(QualifiedExport)}
{(QualifiedExport)->(QualifiedExport)}
(DefaultExport
(VariableDeclaration
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))
(Assignment(Empty){(Identifier)->(Identifier)}(Empty))))
(DefaultExport
(VariableDeclaration
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Identifier)+})+}
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
{ (Identifier)
->(Empty) })
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Empty)-})-}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Empty)-})-}))
(Export
{ (Identifier)
->(Identifier) })
{-(Export
{-(Function
{-(Empty)-}
{-(Empty)-}
{-(Identifier)-}
{-([])-})-})-}
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
{+(Function
{+(Empty)+}
{+(Empty)+}
{+(Identifier)+}
{+([])+})+}
{-(ExportClause
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-})-})
(Export
{+(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+})+}
{-(TextElement)-})
{+(Export
{+(TextElement)+})+}
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty)))
{ (TextElement)
->(TextElement) })
(Export
(ExportClause
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Identifier)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Identifier)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})
{ (TextElement)
->(TextElement) }))
{+(Assignment{+(Empty)+}{+(Identifier)+}{+(Identifier)+})+}
(Assignment(Empty)(Identifier)(Identifier))
(Assignment(Empty)(Identifier){(Identifier)->(Empty)})
{+(Assignment{+(Empty)+}{+(Identifier)+}{+(Empty)+})+}
{-(Assignment{-(Empty)-}{-(Identifier)-}{-(Empty)-})-}
{-(Assignment{-(Empty)-}{-(Identifier)-}{-(Empty)-})-}))
(DefaultExport {(Identifier)->(Identifier)})
{-(DefaultExport {-(Function{-(Empty)-}{-(Empty)-}{-(Identifier)-}{-([])-})-})-}
(DefaultExport (Function(Empty)(Empty)(Empty)([])))
{+(DefaultExport {+(Function{+(Empty)+}{+(Empty)+}{+(Identifier)+}{+([])+})+})+}
{(QualifiedExport)->(QualifiedExport)}
(DefaultExport {(TextElement)->(TextElement)})
{(QualifiedExportFrom {-(Identifier)-})->(QualifiedExportFrom {+(Identifier)+})}
{(QualifiedExportFrom {-(Identifier)-})->(QualifiedExportFrom {+(Identifier)+})})

View File

@ -1,103 +1,20 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(QualifiedExport)
(QualifiedExport)
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport
(Identifier))
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
(Function
(Empty)
(Empty)
(Identifier)
([])))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))))
(Export
(DefaultExport
(Function(Empty)(Empty)(Empty)([])))
(DefaultExport
(Function(Empty)(Empty)(Identifier)([])))
(QualifiedExport)
(DefaultExport
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement)))
(QualifiedExportFrom
(Identifier))
(QualifiedExportFrom
(Identifier)))

View File

@ -1,103 +1,14 @@
(Program
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Identifier))
(Assignment
(Empty)
(Identifier)
(Empty))
(Assignment
(Empty)
(Identifier)
(Empty))))
(Export
(Identifier))
(Export
(Function
(Empty)
(Empty)
(Identifier)
([])))
(Export
(Function
(Empty)
(Empty)
(Empty)
([])))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))))
(Export
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement))
(Export
(ExportClause
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Identifier))
(ImportExportSpecifier
(Identifier)
(Empty)))
(TextElement)))
(QualifiedExport)
(QualifiedExport)
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport
(VariableDeclaration(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Identifier))(Assignment(Empty)(Identifier)(Empty))(Assignment(Empty)(Identifier)(Empty))))
(DefaultExport (Identifier))
(DefaultExport (Function(Empty)(Empty)(Identifier)([])))
(DefaultExport (Function(Empty)(Empty)(Empty)([])))
(QualifiedExport)
(DefaultExport (TextElement))
(QualifiedExportFrom (Identifier))
(QualifiedExportFrom (Identifier)))

View File

@ -31,9 +31,7 @@
{+(Empty)+})+})+}
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))

View File

@ -31,9 +31,7 @@
{-(Empty)-})-})-}
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))

View File

@ -23,9 +23,7 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Return

View File

@ -23,9 +23,7 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Return

View File

@ -1,9 +1,7 @@
(Program
(If
{ (Identifier)
->(MemberAccess
{+(Identifier)+}
{+(Identifier)+}) }
->(Identifier) }
(
(Call
(Identifier)

View File

@ -1,8 +1,6 @@
(Program
(If
{ (MemberAccess
{-(Identifier)-}
{-(Identifier)-})
{ (Identifier)
->(Identifier) }
(
(Call

View File

@ -1,8 +1,6 @@
(Program
(If
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(
(Call
(Identifier)

View File

@ -1,49 +1,41 @@
(Program
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+}
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{ (Import
{-(TextElement)-})
{-(Identifier)-})
->(Import
{+(TextElement)+}) }
{+(
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+})+}
{+(
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+})+}
{+(Import
{+(TextElement)+})+}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})-}
{-(Import
{-(TextElement)-})-})
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
(
(Import
{ (Identifier)
->(Identifier) })
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) })
(
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))
(Import
{ (Identifier)
->(Identifier) }))

View File

@ -1,49 +1,41 @@
(Program
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+}
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+}
{+(
{+(Import
{+(TextElement)+})+}
{+(Import
{+(TextElement)+})+})+}
{+(
{+(Import
{+(TextElement)+})+}
{+(QualifiedImport
{+(TextElement)+}
{+(Identifier)+})+})+}
{+(Import
{+(TextElement)+})+}
{-(Import
{-(TextElement)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(Import
{-(TextElement)-})-})-}
{-(
{-(Import
{-(TextElement)-})-}
{-(QualifiedImport
{-(TextElement)-}
{-(Identifier)-})-})-}
{-(Import
{-(TextElement)-})-})
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) }
(
(Import
{ (Identifier)
->(Identifier) })
{ (Import
{-(Identifier)-})
->(Import
{+(Identifier)+}) })
(
(Import
{ (Identifier)
->(Identifier) })
(QualifiedImport
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))
(Import
{ (Identifier)
->(Identifier) }))

View File

@ -1,25 +1,25 @@
(Program
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(
(Import
(TextElement))
(Identifier))
(Import
(TextElement)))
(Identifier)))
(
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier)))
(Import
(TextElement)))
(Identifier)))

View File

@ -1,25 +1,25 @@
(Program
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(Import
(TextElement))
(Identifier))
(
(Import
(TextElement))
(Identifier))
(Import
(TextElement)))
(Identifier)))
(
(Import
(TextElement))
(Identifier))
(QualifiedImport
(TextElement)
(Identifier)
(Identifier)))
(Import
(TextElement)))
(Identifier)))

View File

@ -1,7 +1,5 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Float)
->(Float) }))

View File

@ -1,7 +1,5 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Float)
->(Float) }))

View File

@ -1,6 +1,4 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)))

View File

@ -1,6 +1,4 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)))

View File

@ -1,5 +1,3 @@
(Program
(MemberAccess
(Identifier)
{ (Identifier)
->(Identifier) }))
{ (Identifier)
->(Identifier) })

View File

@ -1,5 +1,3 @@
(Program
(MemberAccess
(Identifier)
{ (Identifier)
->(Identifier) }))
{ (Identifier)
->(Identifier) })

View File

@ -1,4 +1,2 @@
(Program
(MemberAccess
(Identifier)
(Identifier)))
(Identifier))

View File

@ -1,4 +1,2 @@
(Program
(MemberAccess
(Identifier)
(Identifier)))
(Identifier))

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
{ (TextElement)
->(TextElement) }

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
{ (TextElement)
->(TextElement) }

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(TextElement)
(Empty)))

View File

@ -1,8 +1,6 @@
(Program
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(TextElement)
(Empty)))

View File

@ -38,16 +38,12 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -38,16 +38,12 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -38,14 +38,10 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))))

View File

@ -38,14 +38,10 @@
(Empty)))
(
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Identifier)
(Empty)))))))

View File

@ -1,19 +1,11 @@
(Program
{+(Assignment
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(Identifier)+}
{+(If
{+(Identifier)+}
{+(Identifier)+}
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+}
{+(Identifier)+})+}
{+(Identifier)+})+})+})+}
{-(If
{-(Identifier)-}

View File

@ -4,18 +4,10 @@
{+(Identifier)+}
{+(Identifier)+})+}
{-(Assignment
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(Identifier)-}
{-(If
{-(Identifier)-}
{-(Identifier)-}
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-}
{-(Identifier)-})-}
{-(Identifier)-})-})-})-})

View File

@ -1,17 +1,9 @@
(Program
(Assignment
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(If
(Identifier)
(Identifier)
(MemberAccess
(Identifier)
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(MemberAccess
(MemberAccess
(Identifier)
(Identifier))
(Identifier)))))

View File

@ -1 +1,13 @@
(Program(Function(Empty)(Empty)(Identifier)((VariableDeclaration(Assignment(Empty)(Identifier)(Float)))(Yield(Identifier)))))
(Program
(Function
(Empty)
(Empty)
(Identifier)
(
(VariableDeclaration
(Assignment
(Empty)
(Identifier)
(Float)))
(Yield
(Identifier)))))

View File

@ -1,30 +1,24 @@
(Program
(Export
{+(Function
{+(Empty)+}
{+(Empty)+}
{+(Identifier)+}
{+(RequiredParameter
(DefaultExport
{(Class
{-(Identifier)-}
{-([])-})
->
(Function
{+(Empty)+}
{+(Empty)+}
{+(Annotation
{+(PredefinedType)+})+}
{+(Assignment
{+(Identifier)+}
{+(Empty)+})+})+}
{+(RequiredParameter
{+(Empty)+}
{+(Empty)+}
{+(Annotation
{+(PredefinedType)+})+}
{+(Assignment
{+(Identifier)+}
{+(Empty)+})+})+}
{+(
{+(Return
{+(Identifier)+}
{+(RequiredParameter
{+(Empty)+}
{+(Empty)+}
{+(Annotation{+(PredefinedType)+})+}
{+(Assignment{+(Identifier)+}{+(Empty)+})+})+}
{+(RequiredParameter
{+(Empty)+}
{+(Empty)+}
{+(Annotation{+(PredefinedType)+})+}
{+(Assignment{+(Identifier)+}{+(Empty)+})+})+}
{+({+(Return
{+(Hash
{+(ShorthandPropertyIdentifier)+}
{+(ShorthandPropertyIdentifier)+})+})+})+})+}
{-(Class
{-(Identifier)-}
{-([])-})-}))
{+(ShorthandPropertyIdentifier)+})+})+})+})}))

View File

@ -1,30 +1,10 @@
(Program
(Export
{+(Class
{+(Identifier)+}
{+([])+})+}
{-(Function
{-(Empty)-}
{-(Empty)-}
{-(Identifier)-}
{-(RequiredParameter
(DefaultExport
{(Function
{-(Empty)-}
{-(Empty)-}
{-(Annotation
{-(PredefinedType)-})-}
{-(Assignment
{-(Identifier)-}
{-(Empty)-})-})-}
{-(RequiredParameter
{-(Empty)-}
{-(Empty)-}
{-(Annotation
{-(PredefinedType)-})-}
{-(Assignment
{-(Identifier)-}
{-(Empty)-})-})-}
{-(
{-(Return
{-(Hash
{-(ShorthandPropertyIdentifier)-}
{-(ShorthandPropertyIdentifier)-})-})-})-})-}))
{-(Identifier)-}
{-(RequiredParameter{-(Empty)-}{-(Empty)-}{-(Annotation{-(PredefinedType)-})-}{-(Assignment{-(Identifier)-}{-(Empty)-})-})-}
{-(RequiredParameter{-(Empty)-}{-(Empty)-}{-(Annotation{-(PredefinedType)-})-}{-(Assignment{-(Identifier)-}{-(Empty)-})-})-}
{-({-(Return{-(Hash{-(ShorthandPropertyIdentifier)-}{-(ShorthandPropertyIdentifier)-})-})-})-})
->(Class{+(Identifier)+}{+([])+})}))

View File

@ -1,5 +1,5 @@
(Program
(Export
(DefaultExport
(Class
(Identifier)
([]))))

View File

@ -1,5 +1,5 @@
(Program
(Export
(DefaultExport
(Function
(Empty)
(Empty)

View File

@ -0,0 +1 @@
*.js

View File

@ -0,0 +1,5 @@
export { baz }
function baz() {
return "this is the baz function"
}

View File

@ -1,7 +1,5 @@
export function bar() {
return "this is the bar function"
}
export { baz } from "a"
export default function () {
return "this is the defaultExport function"
function bar() {
return "this is the bar function";
}

View File

@ -1,5 +1,5 @@
// Use `tsc test.ts foo.ts && node test.js` to test evaluation
// Use `tsc main.ts foo.ts && node main.js` to test evaluation
import * as name from "./foo";
import { baz as bar } from "foo";
console.log(name.bar())
bar()

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -17,9 +17,6 @@
(Empty)))
(
(Return
(MemberAccess
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))))
{ (Identifier)
->(Identifier) })))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -16,7 +16,5 @@
(Empty)))
(
(Return
(MemberAccess
(Identifier)
(Identifier)))))
(Identifier))))
(Empty)))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,19 +5,13 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))
(Identifier))
(MemberAccess
{ (Identifier)
->(Identifier) }
(Identifier))
{ (Identifier)
->(Identifier) }
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -5,17 +5,11 @@
(Call
(MemberAccess
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))
(Identifier))
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Empty))))

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
{ (TextElement)
->(TextElement) }

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
{ (TextElement)
->(TextElement) }

View File

@ -1,9 +1,7 @@
(Program
(New
(Call
(MemberAccess
(Identifier)
(Identifier))
(Identifier)
(Float)
(TextElement)
(Empty))))

Some files were not shown because too many files have changed in this diff Show More