Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tla2bAST
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tla2bAST
Commits
64730c30
Commit
64730c30
authored
6 months ago
by
Jan Gruteser
Browse files
Options
Downloads
Patches
Plain Diff
replace some direct ToolObject accesses with getType
parent
160deda7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tla2bAst/BAstCreator.java
+13
-15
13 additions, 15 deletions
src/main/java/de/tla2bAst/BAstCreator.java
with
13 additions
and
15 deletions
src/main/java/de/tla2bAst/BAstCreator.java
+
13
−
15
View file @
64730c30
...
...
@@ -124,7 +124,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
List
<
EnumType
>
printed
=
new
ArrayList
<>();
for
(
OpDeclNode
con
:
moduleNode
.
getConstantDecls
())
{
TLAType
type
=
(
TLA
Type
)
con
.
getToolObject
(
TYPE_ID
);
TLAType
type
=
get
Type
(
con
);
EnumType
e
=
null
;
if
(
type
instanceof
SetType
&&
((
SetType
)
type
).
getSubType
()
instanceof
EnumType
)
{
...
...
@@ -180,7 +180,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
for
(
OpDefNode
opDefNode
:
bDefs
)
{
List
<
PExpression
>
params
=
Arrays
.
stream
(
opDefNode
.
getParams
())
.
map
(
this
::
createIdentifierNode
).
collect
(
Collectors
.
toList
());
// TLAType type =
(TLA
Type
) o
pDefNode
.getToolObject(TYPE_ID
);
// TLAType type =
get
Type
(O
pDefNode);
// if (opDefNode.level == 2 || type instanceof BoolType) {
PDefinition
definition
;
if
(
predicateVsExpression
.
getDefinitionType
(
opDefNode
)
==
DefinitionType
.
PREDICATE
)
{
...
...
@@ -283,7 +283,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
for
(
OpDeclNode
opDeclNode
:
bVariables
)
{
AIdentifierExpression
id
=
createPositionedNode
(
createIdentifierNode
(
getName
(
opDeclNode
)),
opDeclNode
);
list
.
add
(
id
);
types
.
put
(
id
,
(
TLA
Type
)
opDeclNode
.
getToolObject
(
TYPE_ID
));
types
.
put
(
id
,
get
Type
(
opDeclNode
));
}
machineClauseList
.
add
(
new
AVariablesMachineClause
(
list
));
}
...
...
@@ -296,13 +296,13 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
AIdentifierExpression
id
=
createPositionedNode
(
createIdentifierNode
(
getName
(
recDef
.
getOpDefNode
())),
recDef
.
getOpDefNode
());
constantsList
.
add
(
id
);
types
.
put
(
id
,
(
TLA
Type
)
recDef
.
getOpDefNode
()
.
getToolObject
(
TYPE_ID
));
types
.
put
(
id
,
get
Type
(
recDef
.
getOpDefNode
()));
}
for
(
OpDefNode
recFunc
:
specAnalyser
.
getRecursiveFunctions
())
{
AIdentifierExpression
id
=
new
AIdentifierExpression
(
createTIdentifierLiteral
(
getName
(
recFunc
)));
constantsList
.
add
(
id
);
types
.
put
(
id
,
(
TLA
Type
)
recFunc
.
getToolObject
(
TYPE_ID
));
types
.
put
(
id
,
get
Type
(
recFunc
));
}
if
(!
constantsList
.
isEmpty
())
{
...
...
@@ -317,7 +317,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
for
(
OpDeclNode
opDeclNode
:
bConstants
)
{
AIdentifierExpression
id
=
createPositionedNode
(
createIdentifierNode
(
getName
(
opDeclNode
)),
opDeclNode
);
constantsList
.
add
(
id
);
types
.
put
(
id
,
(
TLA
Type
)
opDeclNode
.
getToolObject
(
TYPE_ID
));
types
.
put
(
id
,
get
Type
(
opDeclNode
));
}
if
(!
constantsList
.
isEmpty
())
{
machineClauseList
.
add
(
new
AConstantsMachineClause
(
constantsList
));
...
...
@@ -344,8 +344,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
}
propertiesList
.
add
(
equal
);
}
else
{
TLAType
t
=
(
TLAType
)
con
.
getToolObject
(
TYPE_ID
);
propertiesList
.
add
(
new
AMemberPredicate
(
createIdentifierNode
(
con
),
t
.
getBNode
()));
propertiesList
.
add
(
new
AMemberPredicate
(
createIdentifierNode
(
con
),
getType
(
con
).
getBNode
()));
}
}
...
...
@@ -400,7 +399,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
for
(
RecursiveDefinition
recDef
:
specAnalyser
.
getRecursiveDefinitions
())
{
OpDefNode
def
=
recDef
.
getOpDefNode
();
// TLAType t =
(TLA
Type
)
def
.getToolObject(TYPE_ID
);
// TLAType t =
get
Type
(
def);
// OpApplNode ifThenElse = recDef.getIfThenElse();
FormalParamNode
[]
params
=
def
.
getParams
();
ArrayList
<
PExpression
>
paramList1
=
new
ArrayList
<>();
...
...
@@ -409,7 +408,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
for
(
FormalParamNode
p
:
params
)
{
paramList1
.
add
(
createIdentifierNode
(
p
));
// paramList2.add(createIdentifierNode(p.getName().toString()));
TLAType
paramType
=
(
TLAType
)
p
.
getToolObject
(
TYPE_ID
);
TLAType
paramType
=
getType
(
p
);
AEqualPredicate
equal
=
new
AEqualPredicate
(
createIdentifierNode
(
p
),
paramType
.
getBNode
());
typeList
.
add
(
equal
);
}
...
...
@@ -1240,8 +1239,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
AMemberPredicate
member
=
new
AMemberPredicate
();
member
.
setLeft
(
createIdentifierNode
(
p
));
TLAType
t
=
(
TLAType
)
p
.
getToolObject
(
TYPE_ID
);
member
.
setRight
(
t
.
getBNode
());
member
.
setRight
(
getType
(
p
).
getBNode
());
predList2
.
add
(
member
);
}
lambda2
.
setIdentifiers
(
shiftedParams
);
...
...
@@ -1254,7 +1252,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
}
case
OPCODE_fa:
{
// f[1]
TLAType
t
=
(
TLA
Type
)
n
.
getArgs
()[
0
]
.
getToolObject
(
TYPE_ID
);
TLAType
t
=
get
Type
(
n
.
getArgs
()[
0
]);
if
(
t
instanceof
TupleType
)
{
NumeralNode
num
=
(
NumeralNode
)
n
.
getArgs
()[
1
];
int
field
=
num
.
val
();
...
...
@@ -1327,7 +1325,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
}
case
OPCODE_sor:
{
// $SetOfRcds [L1 : e1, L2 : e2]
SetType
pow
=
(
SetType
)
n
.
getT
oolObject
(
TYPE_ID
);
SetType
pow
=
(
SetType
)
getT
ype
(
n
);
StructType
struct
=
(
StructType
)
pow
.
getSubType
();
ExprOrOpArgNode
[]
args
=
n
.
getArgs
();
Hashtable
<
String
,
PExpression
>
pairTable
=
new
Hashtable
<>();
...
...
@@ -1421,7 +1419,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
}
case
OPCODE_rs:
{
// $RcdSelect r.c
StructType
struct
=
(
StructType
)
n
.
getArgs
()[
0
]
.
getToolObject
(
TYPE_ID
);
StructType
struct
=
(
StructType
)
getType
(
n
.
getArgs
()[
0
]);
if
(
struct
.
isExtensible
())
{
ARecordFieldExpression
rcdSelect
=
new
ARecordFieldExpression
();
rcdSelect
.
setRecord
(
visitExprOrOpArgNodeExpression
(
n
.
getArgs
()[
0
]));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment