diff --git a/src/Language/TypeScript/Syntax/JavaScript.hs b/src/Language/TypeScript/Syntax/JavaScript.hs index a6259b1fb..4903c0769 100644 --- a/src/Language/TypeScript/Syntax/JavaScript.hs +++ b/src/Language/TypeScript/Syntax/JavaScript.hs @@ -28,7 +28,7 @@ instance Evaluatable JavaScriptRequire where bindAll scopeGraph -- alias <- maybeM (throwEvalError NoNameError) (declaredName aliasTerm) -- rvalBox =<< evalRequire modulePath alias - case declaredName (subterm aliasTerm) of + case declaredName aliasTerm of Just alias -> do span <- get @Span void $ declare (Declaration alias) span (ScopeGraph.currentScope scopeGraph) -- TODO: declare shouldn't return a fake (Address address) diff --git a/src/Language/TypeScript/Syntax/TypeScript.hs b/src/Language/TypeScript/Syntax/TypeScript.hs index c0be282c3..955b9ea5e 100644 --- a/src/Language/TypeScript/Syntax/TypeScript.hs +++ b/src/Language/TypeScript/Syntax/TypeScript.hs @@ -53,7 +53,7 @@ instance Evaluatable QualifiedAliasedImport where modulePath <- resolveWithNodejsStrategy importPath typescriptExtensions -- alias <- maybeM (throwEvalError NoNameError) (declaredName aliasTerm) -- rvalBox =<< evalRequire modulePath alias - alias <- maybeM (throwEvalError NoNameError) (declaredName (subterm aliasTerm)) + alias <- maybeM (throwEvalError NoNameError) (declaredName aliasTerm) span <- get @Span (scopeGraph, value) <- require modulePath bindAll scopeGraph @@ -87,10 +87,10 @@ instance Evaluatable QualifiedExport where -- -- Insert the aliases with no addresses. -- for_ exportSymbols $ \Alias{..} -> -- export aliasValue aliasName Nothing - eval (QualifiedExport exportSymbols) = do + eval _ (QualifiedExport exportSymbols) = do -- Create a Lexical edge from the qualifed export's scope to the current scope. currentScopeAddress <- currentScope - let edges = Map.singleton Lexical [ currentScopeAddress ] + let edges = maybe mempty (Map.singleton Lexical . pure) currentScopeAddress scopeAddress <- newScope edges putCurrentScope scopeAddress