1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

[#186] Fix PHP string concatenation and augmented assignment

This commit is contained in:
Kevin Orr 2019-07-02 17:14:09 -04:00
parent 02e56c9251
commit 5b5a9965dc
4 changed files with 12 additions and 2 deletions

View File

@ -398,6 +398,7 @@ instance AccessControls1 PHP.IncludeOnce
instance AccessControls1 PHP.ArrayElement
instance AccessControls1 PHP.GlobalDeclaration
instance AccessControls1 PHP.SimpleVariable
instance AccessControls1 PHP.Concat
instance AccessControls1 PHP.CastType
instance AccessControls1 PHP.ErrorControl
instance AccessControls1 PHP.Clone

View File

@ -146,6 +146,7 @@ type Syntax = '[
, Syntax.ReturnType
, Syntax.ScalarType
, Syntax.ShellCommand
, Syntax.Concat
, Syntax.SimpleVariable
, Syntax.Static
, Syntax.Text
@ -233,7 +234,7 @@ augmentedAssignmentExpression = makeTerm' <$> symbol AugmentedAssignmentExpressi
, assign Expression.DividedBy <$ symbol AnonSlashEqual
, assign Expression.Plus <$ symbol AnonPlusEqual
, assign Expression.Minus <$ symbol AnonMinusEqual
, assign Expression.Times <$ symbol AnonDotEqual
, assign Syntax.Concat <$ symbol AnonDotEqual
, assign Expression.LShift <$ symbol AnonLAngleLAngleEqual
, assign Expression.RShift <$ symbol AnonRAngleRAngleEqual
, assign Expression.BAnd <$ symbol AnonAmpersandEqual
@ -266,7 +267,8 @@ binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm
, (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle
, (inject .) . Expression.Plus <$ symbol AnonPlus
, (inject .) . Expression.Minus <$ symbol AnonMinus
, (inject .) . Expression.Times <$ (symbol AnonStar <|> symbol AnonDot)
, (inject .) . Expression.Times <$ symbol AnonStar
, (inject .) . Syntax.Concat <$ symbol AnonDot
, (inject .) . Expression.DividedBy <$ symbol AnonSlash
, (inject .) . Expression.Modulo <$ symbol AnonPercent
, (inject .) . Expression.InstanceOf <$ symbol AnonInstanceof

View File

@ -128,6 +128,12 @@ newtype SimpleVariable a = SimpleVariable { value :: a }
instance Evaluatable SimpleVariable
data Concat a = Concat { lhs :: a, rhs :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1)
deriving (Eq1, Show1, Ord1) via Generically Concat
instance Evaluatable Concat
-- | TODO: Unify with TypeScript's PredefinedType
newtype CastType a = CastType { _castType :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1)

View File

@ -549,6 +549,7 @@ instance Taggable PHP.IncludeOnce
instance Taggable PHP.ArrayElement
instance Taggable PHP.GlobalDeclaration
instance Taggable PHP.SimpleVariable
instance Taggable PHP.Concat
instance Taggable PHP.CastType
instance Taggable PHP.ErrorControl
instance Taggable PHP.Clone