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
7aad5f51
Commit
7aad5f51
authored
Feb 27, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
General comment clean up, minor code clean up.
parent
bb5f52a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
24 deletions
+18
-24
blocks/logic.js
blocks/logic.js
+3
-3
blocks/loops.js
blocks/loops.js
+3
-14
blocks/text.js
blocks/text.js
+5
-3
blocks/variables.js
blocks/variables.js
+7
-4
No files found.
blocks/logic.js
View file @
7aad5f51
...
...
@@ -388,8 +388,8 @@ Blockly.Blocks['logic_negate'] = {
this
.
setTooltip
(
Blockly
.
Msg
.
LOGIC_NEGATE_TOOLTIP
);
},
/**
* Assigns a type to the block, not
input is meant to be a booleans, so it
* should return the same.
* Assigns a type to the block, not
block input is meant to be a booleans, so
*
it
should return the same.
*/
getType
:
function
()
{
return
'
boolean
'
;
...
...
@@ -433,7 +433,7 @@ Blockly.Blocks['logic_null'] = {
.
appendField
(
Blockly
.
Msg
.
LOGIC_NULL
);
this
.
setTooltip
(
Blockly
.
Msg
.
LOGIC_NULL_TOOLTIP
);
}
// Null does not have a type, so no getType.
// Null does not have a type, so no getType.
Might change this in the future.
};
Blockly
.
Blocks
[
'
logic_ternary
'
]
=
{
...
...
blocks/loops.js
View file @
7aad5f51
...
...
@@ -173,7 +173,9 @@ Blockly.Blocks['controls_for'] = {
* Finds the type of the variable selected in the drop down. Sets it to an
* an integer if it has not been defined before.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associative array of variables already
* defined. Variable name as the key,
* type as their value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
...
...
@@ -183,7 +185,6 @@ Blockly.Blocks['controls_for'] = {
// Check if variable has been defined already
var
varType
=
Blockly
.
StaticTyping
.
findListVarType
(
varName
,
existingVars
);
if
(
varType
!=
null
)
{
this
.
varType
=
varType
;
if
((
varType
!=
'
int
'
)
&&
(
varType
!=
'
float
'
))
{
this
.
setWarningText
(
'
This variable type has been previously set to a
'
+
existingVars
[
varName
]
+
'
and it needs to be a number!
'
)
...
...
@@ -193,22 +194,10 @@ Blockly.Blocks['controls_for'] = {
}
else
{
// not defined, so set it to an int
varType
=
'
int
'
;
this
.
varType
=
'
int
'
;
this
.
setWarningText
(
null
);
}
return
varType
;
},
/**
* Contains the type of the variable selected from the drop down.
*/
varType
:
'
nonono
'
,
/**
* Retrieves the type of the selected variable, defined at getVarType.
* @this Blockly.Block
*/
getType
:
function
()
{
return
this
.
varType
;
}
};
...
...
blocks/text.js
View file @
7aad5f51
...
...
@@ -61,7 +61,7 @@ Blockly.Blocks['text'] = {
return
new
Blockly
.
FieldImage
(
Blockly
.
pathToMedia
+
file
,
12
,
12
,
'
"
'
);
},
/**
* Assigns a type to the block,
it always return
s a string.
* Assigns a type to the block,
text block is alway
s a string.
*/
getType
:
function
()
{
return
'
String
'
;
...
...
@@ -194,7 +194,7 @@ Blockly.Blocks['text_join'] = {
}
},
/**
* Assigns a type to the block,
it
always returns a string.
* Assigns a type to the block,
this block
always returns a string.
*/
getType
:
function
()
{
return
'
String
'
;
...
...
@@ -278,7 +278,9 @@ Blockly.Blocks['text_append'] = {
* Finds the type of the variable selected in the drop down. Sets it to an
* a string if it has not been defined before.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associativ array of variables already
* defined. Variable name as key, and
* type as value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
...
...
blocks/variables.js
View file @
7aad5f51
...
...
@@ -86,10 +86,11 @@ Blockly.Blocks['variables_get'] = {
options
.
push
(
option
);
},
/**
* Finds the type of the selected variable. Need to find the original
* variable set block to save the type into the varType block variable.
* Finds the type of the selected variable.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associative array of variables already
* defined. Var names as key and type as
* value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
...
...
@@ -167,7 +168,9 @@ Blockly.Blocks['variables_set'] = {
/**
* Searches through the nested blocks to find a variable type.
* @this Blockly.Block
* @param {Array<string>} existingVars List of variables already defined.
* @param {Array<string>} existingVars Associative array of variables already
* defined. Var name as the key, type as
* the value.
* @return {string} String to indicate the type if it has not been defined
* before.
*/
...
...
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