Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Dynare
preprocessor
Commits
eeb56008
Verified
Commit
eeb56008
authored
Aug 7, 2019
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
more changes missed in `
309326c3
`
parent
00172ec1
No related branches found
No related tags found
No related merge requests found
Pipeline
#1582
passed
Aug 7, 2019
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/macro/Expressions.cc
+8
-8
8 additions, 8 deletions
src/macro/Expressions.cc
with
8 additions
and
8 deletions
src/macro/Expressions.cc
+
8
−
8
View file @
eeb56008
...
@@ -337,7 +337,7 @@ String::cast_real() const
...
@@ -337,7 +337,7 @@ String::cast_real() const
}
}
catch
(...)
catch
(...)
{
{
throw
StackTrace
(
R"(")"
+
value
+
R"(" cannot be converted to a
double
)"
);
throw
StackTrace
(
R"(")"
+
value
+
R"(" cannot be converted to a
real
)"
);
}
}
}
}
...
@@ -417,7 +417,7 @@ Array::power(const BaseTypePtr &btp) const
...
@@ -417,7 +417,7 @@ Array::power(const BaseTypePtr &btp) const
{
{
auto
btp2
=
dynamic_pointer_cast
<
Real
>
(
btp
);
auto
btp2
=
dynamic_pointer_cast
<
Real
>
(
btp
);
if
(
!
btp2
)
if
(
!
btp2
)
throw
StackTrace
(
"The second argument of the power operator (^) must be a
double
"
);
throw
StackTrace
(
"The second argument of the power operator (^) must be a
real
"
);
auto
retval
=
make_shared
<
Array
>
(
arr
,
env
);
auto
retval
=
make_shared
<
Array
>
(
arr
,
env
);
for
(
int
i
=
1
;
i
<
*
btp2
;
i
++
)
for
(
int
i
=
1
;
i
<
*
btp2
;
i
++
)
...
@@ -548,7 +548,7 @@ RealPtr
...
@@ -548,7 +548,7 @@ RealPtr
Array
::
cast_real
()
const
Array
::
cast_real
()
const
{
{
if
(
arr
.
size
()
!=
1
)
if
(
arr
.
size
()
!=
1
)
throw
StackTrace
(
"Array must be of size 1 to be cast to a
double
"
);
throw
StackTrace
(
"Array must be of size 1 to be cast to a
real
"
);
return
arr
.
at
(
0
)
->
eval
()
->
cast_real
();
return
arr
.
at
(
0
)
->
eval
()
->
cast_real
();
}
}
...
@@ -598,7 +598,7 @@ RealPtr
...
@@ -598,7 +598,7 @@ RealPtr
Tuple
::
cast_real
()
const
Tuple
::
cast_real
()
const
{
{
if
(
tup
.
size
()
!=
1
)
if
(
tup
.
size
()
!=
1
)
throw
StackTrace
(
"Tuple must be of size 1 to be cast to a
double
"
);
throw
StackTrace
(
"Tuple must be of size 1 to be cast to a
real
"
);
return
tup
.
at
(
0
)
->
eval
()
->
cast_real
();
return
tup
.
at
(
0
)
->
eval
()
->
cast_real
();
}
}
...
@@ -611,7 +611,7 @@ Array::eval()
...
@@ -611,7 +611,7 @@ Array::eval()
RealPtr
range2dbl
=
dynamic_pointer_cast
<
Real
>
(
range2
->
eval
());
RealPtr
range2dbl
=
dynamic_pointer_cast
<
Real
>
(
range2
->
eval
());
if
(
!
range1dbl
||
!
range2dbl
)
if
(
!
range1dbl
||
!
range2dbl
)
throw
StackTrace
(
"To create an array from a range using the colon operator, "
throw
StackTrace
(
"To create an array from a range using the colon operator, "
"the arguments must evaluate to
double
s"
);
"the arguments must evaluate to
real
s"
);
RealPtr
incdbl
=
make_shared
<
Real
>
(
1
,
env
);
RealPtr
incdbl
=
make_shared
<
Real
>
(
1
,
env
);
if
(
increment
)
if
(
increment
)
...
@@ -619,7 +619,7 @@ Array::eval()
...
@@ -619,7 +619,7 @@ Array::eval()
incdbl
=
dynamic_pointer_cast
<
Real
>
(
increment
->
eval
());
incdbl
=
dynamic_pointer_cast
<
Real
>
(
increment
->
eval
());
if
(
!
incdbl
)
if
(
!
incdbl
)
throw
StackTrace
(
"To create an array from a range using the colon operator, "
throw
StackTrace
(
"To create an array from a range using the colon operator, "
"the increment must evaluate to a
double
"
);
"the increment must evaluate to a
real
"
);
}
}
if
(
*
incdbl
>
0
&&
*
range1dbl
<
*
range2dbl
)
if
(
*
incdbl
>
0
&&
*
range1dbl
<
*
range2dbl
)
...
@@ -693,7 +693,7 @@ Variable::eval()
...
@@ -693,7 +693,7 @@ Variable::eval()
case
codes
::
BaseType
::
Bool
:
case
codes
::
BaseType
::
Bool
:
throw
StackTrace
(
"variable"
,
"You cannot index a boolean"
,
location
);
throw
StackTrace
(
"variable"
,
"You cannot index a boolean"
,
location
);
case
codes
::
BaseType
::
Real
:
case
codes
::
BaseType
::
Real
:
throw
StackTrace
(
"variable"
,
"You cannot index a
double
"
,
location
);
throw
StackTrace
(
"variable"
,
"You cannot index a
real
"
,
location
);
case
codes
::
BaseType
::
Tuple
:
case
codes
::
BaseType
::
Tuple
:
throw
StackTrace
(
"variable"
,
"You cannot index a tuple"
,
location
);
throw
StackTrace
(
"variable"
,
"You cannot index a tuple"
,
location
);
case
codes
::
BaseType
::
String
:
case
codes
::
BaseType
::
String
:
...
@@ -1020,7 +1020,7 @@ Comprehension::eval()
...
@@ -1020,7 +1020,7 @@ Comprehension::eval()
dp
=
dynamic_pointer_cast
<
Real
>
(
c_when
->
eval
());
dp
=
dynamic_pointer_cast
<
Real
>
(
c_when
->
eval
());
bp
=
dynamic_pointer_cast
<
Bool
>
(
c_when
->
eval
());
bp
=
dynamic_pointer_cast
<
Bool
>
(
c_when
->
eval
());
if
(
!
bp
&&
!
dp
)
if
(
!
bp
&&
!
dp
)
throw
StackTrace
(
"The condition must evaluate to a boolean or a
double
"
);
throw
StackTrace
(
"The condition must evaluate to a boolean or a
real
"
);
}
}
catch
(
StackTrace
&
ex
)
catch
(
StackTrace
&
ex
)
{
{
...
...
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