Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Vivy
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
7b07dfec
Vérifiée
Valider
7b07dfec
rédigé
Il y a 3 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
EXPR: Implement toString for IrExpression
parent
b2c93379
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!25
Draft: New Vivy module spec
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/Lib/Script/Ast/IrExpression.cc
+64
-6
64 ajouts, 6 suppressions
src/Lib/Script/Ast/IrExpression.cc
src/Lib/Script/Ast/IrExpression.hh
+3
-2
3 ajouts, 2 suppressions
src/Lib/Script/Ast/IrExpression.hh
avec
67 ajouts
et
8 suppressions
src/Lib/Script/Ast/IrExpression.cc
+
64
−
6
Voir le fichier @
7b07dfec
#include
"IrExpression.hh"
#include
"IrExpression.hh"
#include
"IrFunction.hh"
#include
"IrElement.hh"
#include
"IrElement.hh"
#include
"IrVariable.hh"
#include
"IrVariable.hh"
#include
"IrType.hh"
#include
"IrType.hh"
...
@@ -80,7 +81,18 @@ namespace Vivy::Script
...
@@ -80,7 +81,18 @@ namespace Vivy::Script
std
::
string
std
::
string
IrEVariableRef
::
toString
()
const
noexcept
IrEVariableRef
::
toString
()
const
noexcept
{
{
return
"IrEVariableRef"
;
std
::
string
ret
=
referencedVariable
->
toString
();
if
(
indicies
.
size
()
!=
0
)
{
ret
+=
"{"
;
size_t
i
;
for
(
i
=
0
;
i
<
indicies
.
size
()
-
1
;
i
+=
1
)
{
ret
+=
indicies
.
at
(
i
)
->
toString
();
ret
+=
","
;
}
ret
+=
indicies
.
at
(
i
)
->
toString
();
ret
+=
"}"
;
}
return
ret
;
}
}
}
}
...
@@ -132,7 +144,7 @@ IrEConstExpr::IrEConstExpr(const Token &singleElement)
...
@@ -132,7 +144,7 @@ IrEConstExpr::IrEConstExpr(const Token &singleElement)
}
}
case
Token
::
Type
::
QNAME
:
case
Token
::
Type
::
QNAME
:
default
:
throw
std
::
logic_error
(
"IrEConstExpr unexpected token: "
+
singleElement
.
toString
());
throw
std
::
logic_error
(
"IrEConstExpr unexpected token: "
+
singleElement
.
toString
());
}
}
}
}
...
@@ -200,7 +212,15 @@ namespace Vivy::Script
...
@@ -200,7 +212,15 @@ namespace Vivy::Script
std
::
string
std
::
string
IrECall
::
toString
()
const
noexcept
IrECall
::
toString
()
const
noexcept
{
{
return
"IrECall"
;
std
::
string
ret
=
callPtr
->
parent
()
->
name
().
toStdString
()
+
"."
;
ret
+=
callPtr
->
name
().
toStdString
()
+
"("
;
size_t
i
;
for
(
i
=
0
;
i
<
inArgs
.
size
()
-
1
;
i
+=
1
)
{
ret
+=
inArgs
.
at
(
i
)
->
toString
();
ret
+=
","
;
}
ret
+=
inArgs
.
at
(
i
)
->
toString
()
+
")"
;
return
ret
;
}
}
const
IrFunction
*
const
IrFunction
*
...
@@ -221,7 +241,7 @@ namespace Vivy::Script
...
@@ -221,7 +241,7 @@ namespace Vivy::Script
std
::
string
std
::
string
IrECompOp
::
toString
()
const
noexcept
IrECompOp
::
toString
()
const
noexcept
{
{
return
"IrECompOp"
;
return
left
->
toString
()
+
::
Vivy
::
Script
::
toString
(
selfOpType
)
+
right
->
toString
()
;
}
}
}
}
...
@@ -230,7 +250,7 @@ namespace Vivy::Script
...
@@ -230,7 +250,7 @@ namespace Vivy::Script
std
::
string
std
::
string
IrEArithmeticOp
::
toString
()
const
noexcept
IrEArithmeticOp
::
toString
()
const
noexcept
{
{
return
"IrEArithmeticOp"
;
return
left
->
toString
()
+
::
Vivy
::
Script
::
toString
(
selfOpType
)
+
right
->
toString
()
;
}
}
}
}
...
@@ -239,6 +259,44 @@ namespace Vivy::Script
...
@@ -239,6 +259,44 @@ namespace Vivy::Script
std
::
string
std
::
string
IrELogicOp
::
toString
()
const
noexcept
IrELogicOp
::
toString
()
const
noexcept
{
{
return
"IrELogicOp"
;
return
left
->
toString
()
+
::
Vivy
::
Script
::
toString
(
selfOpType
)
+
right
->
toString
();
}
}
namespace
Vivy
::
Script
{
std
::
string
toString
(
IrELogicOp
::
OpType
op
)
noexcept
{
switch
(
op
)
{
case
IrELogicOp
::
OpType
::
And
:
return
"and"
;
case
IrELogicOp
::
OpType
::
Or
:
return
"or"
;
case
IrELogicOp
::
OpType
::
Xor
:
return
"xor"
;
}
}
std
::
string
toString
(
IrEArithmeticOp
::
OpType
op
)
noexcept
{
switch
(
op
)
{
case
IrEArithmeticOp
::
OpType
::
Sub
:
return
"sub"
;
case
IrEArithmeticOp
::
OpType
::
Add
:
return
"add"
;
case
IrEArithmeticOp
::
OpType
::
Mul
:
return
"mul"
;
case
IrEArithmeticOp
::
OpType
::
Div
:
return
"div"
;
case
IrEArithmeticOp
::
OpType
::
Mod
:
return
"mod"
;
}
}
std
::
string
toString
(
IrECompOp
::
OpType
op
)
noexcept
{
switch
(
op
)
{
case
IrECompOp
::
OpType
::
LT
:
return
"<"
;
case
IrECompOp
::
OpType
::
LE
:
return
"<="
;
case
IrECompOp
::
OpType
::
GT
:
return
">"
;
case
IrECompOp
::
OpType
::
GE
:
return
">="
;
case
IrECompOp
::
OpType
::
EQ
:
return
"=="
;
case
IrECompOp
::
OpType
::
NEQ
:
return
"!="
;
}
}
}
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
src/Lib/Script/Ast/IrExpression.hh
+
3
−
2
Voir le fichier @
7b07dfec
...
@@ -129,13 +129,14 @@ class IrEVariableRef : public IrExpression {
...
@@ -129,13 +129,14 @@ class IrEVariableRef : public IrExpression {
VIVY_IR_ELEMENT
(
IrEVariableRef
)
VIVY_IR_ELEMENT
(
IrEVariableRef
)
IrVariable
*
const
referencedVariable
;
IrVariable
*
const
referencedVariable
;
std
::
vector
<
IrExpression
*>
indicies
;
IrEVariableRef
(
IrVariable
*
)
noexcept
;
IrEVariableRef
(
IrVariable
*
)
noexcept
;
IrEVariableRef
(
IrVariable
*
,
std
::
vector
<
IrExpression
*>
&&
);
IrEVariableRef
(
IrVariable
*
,
std
::
vector
<
IrExpression
*>
&&
);
template
<
typename
...
Args
>
IrEVariableRef
(
IrVariable
*
var
,
Args
&&
...
indicies
)
template
<
typename
...
Args
>
IrEVariableRef
(
IrVariable
*
var
,
Args
&&
...
indicie
Arg
s
)
:
IrEVariableRef
(
var
,
std
::
vector
<
IrExpression
*>
{
indicies
...
})
:
IrEVariableRef
(
var
,
std
::
vector
<
IrExpression
*>
{
indicie
Arg
s
...
})
{
{
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter