Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
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
appinventor-sources
Commits
a5efc617
Commit
a5efc617
authored
Nov 01, 2019
by
Evan W. Patton
Committed by
Susan Rati Lane
Nov 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make empty component setter sockets errors, not warnings
Change-Id: I59456500e2e89b0ce43f0f80f5d447dae8b8a2ea
parent
ab7650f1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
appinventor/blocklyeditor/src/blocks/components.js
appinventor/blocklyeditor/src/blocks/components.js
+9
-2
appinventor/blocklyeditor/src/msg/en/_messages.js
appinventor/blocklyeditor/src/msg/en/_messages.js
+2
-0
appinventor/blocklyeditor/src/warningHandler.js
appinventor/blocklyeditor/src/warningHandler.js
+23
-0
No files found.
appinventor/blocklyeditor/src/blocks/components.js
View file @
a5efc617
...
...
@@ -591,6 +591,9 @@ Blockly.Blocks.component_method = {
var
mode
=
this
.
typeName
===
"
Form
"
?
"
Screen
"
:
this
.
typeName
;
return
Blockly
.
ComponentBlock
.
METHODS_HELPURLS
[
mode
];
},
init
:
function
()
{
this
.
genericComponentInput
=
Blockly
.
Msg
.
LANG_COMPONENT_BLOCK_GENERIC_METHOD_TITLE_FOR_COMPONENT
;
},
mutationToDom
:
function
()
{
...
...
@@ -745,7 +748,8 @@ Blockly.Blocks.component_method = {
this
.
setNextStatement
(
true
);
}
this
.
errors
=
[{
name
:
"
checkIfUndefinedBlock
"
},{
name
:
"
checkIsInDefinition
"
},{
name
:
"
checkComponentNotExistsError
"
}];
this
.
errors
=
[{
name
:
"
checkIfUndefinedBlock
"
},
{
name
:
"
checkIsInDefinition
"
},
{
name
:
"
checkComponentNotExistsError
"
},
{
name
:
"
checkGenericComponentSocket
"
}];
// mark the block bad if the method isn't defined or is marked deprecated
var
method
=
this
.
getMethodTypeObject
();
...
...
@@ -939,6 +943,7 @@ Blockly.Blocks.component_set_get = {
init
:
function
()
{
this
.
componentDropDown
=
Blockly
.
ComponentBlock
.
createComponentDropDown
(
this
);
this
.
genericComponentInput
=
Blockly
.
Msg
.
LANG_COMPONENT_BLOCK_GENERIC_SETTER_TITLE_OF_COMPONENT
;
},
mutationToDom
:
function
()
{
...
...
@@ -1085,7 +1090,9 @@ Blockly.Blocks.component_set_get = {
this
.
setTooltip
(
tooltipDescription
);
this
.
errors
=
[{
name
:
"
checkIfUndefinedBlock
"
},{
name
:
"
checkIsInDefinition
"
},{
name
:
"
checkComponentNotExistsError
"
}];
this
.
errors
=
[{
name
:
"
checkIfUndefinedBlock
"
},
{
name
:
"
checkIsInDefinition
"
},
{
name
:
"
checkComponentNotExistsError
"
},
{
name
:
'
checkGenericComponentSocket
'
},
{
name
:
'
checkEmptySetterSocket
'
}];
if
(
thisBlock
.
propertyObject
&&
this
.
propertyObject
.
deprecated
===
"
true
"
&&
this
.
workspace
===
Blockly
.
mainWorkspace
)
{
// [lyn, 2015/12/27] mark deprecated properties as bad
...
...
appinventor/blocklyeditor/src/msg/en/_messages.js
View file @
a5efc617
...
...
@@ -1397,6 +1397,8 @@ Blockly.Msg.en.switch_language_to_english = {
Blockly
.
Msg
.
HIDE_WARNINGS
=
"
Hide Warnings
"
;
Blockly
.
Msg
.
MISSING_SOCKETS_WARNINGS
=
"
You should fill all of the sockets with blocks
"
;
Blockly
.
Msg
.
WRONG_TYPE_BLOCK_WARINGS
=
"
This block should be connected to an event block or a procedure definition
"
;
Blockly
.
Msg
.
ERROR_PROPERTY_SETTER_NEEDS_VALUE
=
'
This block needs a value block connected to its socket.
'
;
Blockly
.
Msg
.
ERROR_GENERIC_NEEDS_COMPONENT
=
'
You need to provide a valid component to this block
\'
s "%1" socket.
'
;
// Messages from replmgr.js
Blockly
.
Msg
.
REPL_ERROR_FROM_COMPANION
=
"
Error from Companion
"
;
...
...
appinventor/blocklyeditor/src/warningHandler.js
View file @
a5efc617
...
...
@@ -604,6 +604,29 @@ Blockly.WarningHandler.prototype.checkDisposedBlock = function(block){
}
};
Blockly
.
WarningHandler
.
prototype
[
'
checkEmptySetterSocket
'
]
=
function
(
block
)
{
if
(
block
.
setOrGet
===
'
set
'
)
{
var
value
=
block
.
getInputTargetBlock
(
'
VALUE
'
);
if
(
!
value
)
{
block
.
setErrorIconText
(
Blockly
.
Msg
.
ERROR_PROPERTY_SETTER_NEEDS_VALUE
);
return
true
;
}
}
return
false
;
};
Blockly
.
WarningHandler
.
prototype
[
'
checkGenericComponentSocket
'
]
=
function
(
block
)
{
if
(
block
.
isGeneric
)
{
var
value
=
block
.
getInputTargetBlock
(
'
COMPONENT
'
);
if
(
!
value
)
{
block
.
setErrorIconText
(
Blockly
.
Msg
.
ERROR_GENERIC_NEEDS_COMPONENT
.
replace
(
/%1/
,
block
.
genericComponentInput
));
return
true
;
}
}
return
false
;
};
//Warnings
//Warnings indicate that there is a problem with the project, but it will not run
...
...
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