Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
adc1c5a3
Commit
adc1c5a3
authored
Mar 03, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore order of operations on same-order groups.
parent
57d0ffa6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
core/generator.js
core/generator.js
+14
-10
No files found.
core/generator.js
View file @
adc1c5a3
...
@@ -208,10 +208,13 @@ Blockly.Generator.prototype.valueToCode = function(block, name, order) {
...
@@ -208,10 +208,13 @@ Blockly.Generator.prototype.valueToCode = function(block, name, order) {
if
(
isNaN
(
innerOrder
))
{
if
(
isNaN
(
innerOrder
))
{
throw
'
Expecting valid order from value block "
'
+
targetBlock
.
type
+
'
".
'
;
throw
'
Expecting valid order from value block "
'
+
targetBlock
.
type
+
'
".
'
;
}
}
if
(
code
&&
order
<=
innerOrder
)
{
if
(
order
==
innerOrder
&&
(
order
==
0
||
order
==
99
))
{
// Don't generate parens around NONE-NONE and ATOMIC-ATOMIC pairs.
// 0 is the atomic order, 99 is the none order. No parentheses needed.
// 0 is the atomic order, 99 is the none order. No parentheses needed.
// In all known languages multiple such code blocks are not order
// In all known languages multiple such code blocks are not order
// sensitive. In fact in Python ('a' 'b') 'c' would fail.
// sensitive. In fact in Python ('a' 'b') 'c' would fail.
if
(
code
&&
order
<=
innerOrder
&&
order
!=
0
&&
order
!=
99
)
{
}
else
{
// The operators outside this code are stonger than the operators
// The operators outside this code are stonger than the operators
// inside this code. To prevent the code from being pulled apart,
// inside this code. To prevent the code from being pulled apart,
// wrap the code in parentheses.
// wrap the code in parentheses.
...
@@ -219,6 +222,7 @@ Blockly.Generator.prototype.valueToCode = function(block, name, order) {
...
@@ -219,6 +222,7 @@ Blockly.Generator.prototype.valueToCode = function(block, name, order) {
// However all known (sane) languages use parentheses for grouping.
// However all known (sane) languages use parentheses for grouping.
code
=
'
(
'
+
code
+
'
)
'
;
code
=
'
(
'
+
code
+
'
)
'
;
}
}
}
return
code
;
return
code
;
};
};
...
...
Write
Preview
Markdown
is supported
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