Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
languages
CNNArchLang
Commits
afb3db82
Commit
afb3db82
authored
Aug 17, 2019
by
Sebastian Nickels
Browse files
Allow outputs to be used as inputs
parent
e42bc2ad
Pipeline
#172953
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/VariableSymbol.java
View file @
afb3db82
...
@@ -342,7 +342,8 @@ public class VariableSymbol extends ArchitectureElementSymbol {
...
@@ -342,7 +342,8 @@ public class VariableSymbol extends ArchitectureElementSymbol {
public
List
<
ArchTypeSymbol
>
computeOutputTypes
()
{
public
List
<
ArchTypeSymbol
>
computeOutputTypes
()
{
if
(
isAtomic
())
{
if
(
isAtomic
())
{
if
(
getType
()
==
Type
.
IO
)
{
if
(
getType
()
==
Type
.
IO
)
{
if
(
isInput
())
{
// Allow inputs and outputs to be used as input
if
(
isInput
()
||
getOutputElement
().
isPresent
())
{
return
Collections
.
singletonList
(((
IODeclarationSymbol
)
getDeclaration
()).
getType
());
return
Collections
.
singletonList
(((
IODeclarationSymbol
)
getDeclaration
()).
getType
());
}
}
else
{
else
{
...
@@ -387,9 +388,12 @@ public class VariableSymbol extends ArchitectureElementSymbol {
...
@@ -387,9 +388,12 @@ public class VariableSymbol extends ArchitectureElementSymbol {
}
}
if
(
getInputTypes
().
size
()
!=
1
)
{
if
(
getInputTypes
().
size
()
!=
1
)
{
Log
.
error
(
"0"
+
ErrorCodes
.
INVALID_ELEMENT_INPUT_SHAPE
+
" Invalid number of input streams. "
+
// Allow no input when output is used as input
"The number of input streams for the output '"
+
name
+
"' is "
+
getInputTypes
().
size
()
+
"."
if
(!(
getInputTypes
().
size
()
==
0
&&
getOutputElement
().
isPresent
()))
{
,
getSourcePosition
());
Log
.
error
(
"0"
+
ErrorCodes
.
INVALID_ELEMENT_INPUT_SHAPE
+
" Invalid number of input streams. "
+
"The number of input streams for the output '"
+
name
+
"' is "
+
getInputTypes
().
size
()
+
"."
,
getSourcePosition
());
}
}
else
{
}
else
{
ASTElementType
inputType
=
getInputTypes
().
get
(
0
).
getDomain
();
ASTElementType
inputType
=
getInputTypes
().
get
(
0
).
getDomain
();
ASTElementType
outputType
=
ioDeclaration
.
getType
().
getDomain
();
ASTElementType
outputType
=
ioDeclaration
.
getType
().
getDomain
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment