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

Map fromClause to Identifier

This commit is contained in:
joshvera 2018-03-07 14:59:40 -05:00
parent af4a489594
commit db9a816163

View File

@ -637,7 +637,6 @@ importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children
<|> makeImport <$> symbol Grammar.ImportStatement <*> children bareRequireImport <|> makeImport <$> symbol Grammar.ImportStatement <*> children bareRequireImport
where where
-- Straightforward imports -- Straightforward imports
stripQuotes = B.filter (/= (fromIntegral (ord '\"')))
makeImport loc (Just alias, symbols, from) = makeTerm loc (Declaration.QualifiedImport from alias symbols) makeImport loc (Just alias, symbols, from) = makeTerm loc (Declaration.QualifiedImport from alias symbols)
makeImport loc (Nothing, symbols, from) = makeTerm loc (Declaration.Import from 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") -- Import a file giving it an alias (e.g. import foo = require "./foo")
@ -666,6 +665,9 @@ importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children
makeNameAliasPair from (Just alias) = (from, alias) makeNameAliasPair from (Just alias) = (from, alias)
makeNameAliasPair from Nothing = (from, from) makeNameAliasPair from Nothing = (from, from)
stripQuotes = B.filter (/= (fromIntegral (ord '\"')))
debuggerStatement :: Assignment debuggerStatement :: Assignment
debuggerStatement = makeTerm <$> symbol Grammar.DebuggerStatement <*> (TypeScript.Syntax.Debugger <$ source) debuggerStatement = makeTerm <$> symbol Grammar.DebuggerStatement <*> (TypeScript.Syntax.Debugger <$ source)
@ -722,7 +724,7 @@ exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> children (flip
-- makeExport2 decorators fromClause exportClause = Declaration.QualifiedExport fromClause exportClause -- makeExport2 decorators fromClause exportClause = Declaration.QualifiedExport fromClause exportClause
fromClause :: Assignment fromClause :: Assignment
fromClause = string fromClause = makeTerm <$> symbol Grammar.String <*> (Syntax.Identifier . stripQuotes <$> source)
propertySignature :: Assignment propertySignature :: Assignment
propertySignature = makePropertySignature <$> symbol Grammar.PropertySignature <*> children ((,,,) <$> (term accessibilityModifier' <|> emptyTerm) <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm)) propertySignature = makePropertySignature <$> symbol Grammar.PropertySignature <*> children ((,,,) <$> (term accessibilityModifier' <|> emptyTerm) <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm))