Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
29a2aa87
Commit
29a2aa87
authored
Aug 01, 2012
by
Florian Hölzl
Browse files
bugfix YELLOW
refs 934
parent
8381549a
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.expression/trunk/src/org/fortiss/af3/expression/language/TypeChecker.java
View file @
29a2aa87
...
...
@@ -67,7 +67,7 @@ import org.fortiss.af3.project.typesystem.ITypeChecker;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
GREEN
Hash:
476B43BAE64CD3A4CFCE10B128CD65A9
* @ConQAT.Rating
YELLOW
Hash:
7BA238DAECF4630D6D695458F7FD43F3
*/
public
class
TypeChecker
implements
ITypeChecker
{
...
...
@@ -229,7 +229,7 @@ public class TypeChecker implements ITypeChecker {
case
MULTIPLY:
case
DIVIDE:
case
MODULO:
return
typecheckArithmetic
(
call
,
operator
,
context
);
return
typecheckArithmetic
(
call
,
expected
,
operator
,
context
);
case
GREATER_EQUAL:
case
GREATER_THAN:
case
LOWER_EQUAL:
...
...
@@ -321,7 +321,8 @@ public class TypeChecker implements ITypeChecker {
}
/** Type-checks arithmetic {@link FunctionCall}s. */
private
boolean
typecheckArithmetic
(
FunctionCall
call
,
EOperator
operator
,
EObject
context
)
{
private
boolean
typecheckArithmetic
(
FunctionCall
call
,
IType
expected
,
EOperator
operator
,
EObject
context
)
{
ITerm
left
=
call
.
getArguments
(
0
);
ITerm
right
=
call
.
getArguments
(
1
);
switch
(
operator
)
{
...
...
@@ -330,8 +331,13 @@ public class TypeChecker implements ITypeChecker {
case
MULTIPLY:
case
DIVIDE:
case
MODULO:
return
typecheckIntOperands
(
left
,
right
,
context
)
||
typecheckDoubleOperands
(
left
,
right
,
context
);
if
(
expected
instanceof
TInt
)
{
return
typecheckIntOperands
(
left
,
right
,
context
);
}
if
(
expected
instanceof
TDouble
)
{
return
typecheckDoubleOperands
(
left
,
right
,
context
);
}
return
false
;
default
:
return
raiseUnsupportedITermInTypeCheckException
(
call
);
}
...
...
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