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
0b42cb2a
Unverified
Commit
0b42cb2a
authored
Oct 23, 2023
by
Jos
Committed by
GitHub
Oct 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter out deprecated methods, events and properties for typeblocks (#3011)
parent
87fb6ad5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
appinventor/blocklyeditor/src/blocks/components.js
appinventor/blocklyeditor/src/blocks/components.js
+22
-8
appinventor/blocklyeditor/src/component_database.js
appinventor/blocklyeditor/src/component_database.js
+4
-2
No files found.
appinventor/blocklyeditor/src/blocks/components.js
View file @
0b42cb2a
...
...
@@ -1364,22 +1364,36 @@ Blockly.Blocks.component_set_get = {
}
componentDb
.
forEachInstance
(
function
(
component
)
{
// Filter out all deprecated properties for both get and set
var
deprecatedProperties
=
[]
var
allCurrentProperties
=
componentDb
.
types_
[
component
.
typeName
].
properties
;
for
(
var
prop
in
allCurrentProperties
)
{
if
(
allCurrentProperties
[
prop
].
deprecated
)
{
deprecatedProperties
.
push
(
allCurrentProperties
[
prop
].
name
);
}
}
var
setters
=
componentDb
.
getSetterNamesForType
(
component
.
typeName
),
getters
=
componentDb
.
getGetterNamesForType
(
component
.
typeName
),
k
;
for
(
k
=
0
;
k
<
setters
.
length
;
k
++
)
{
pushBlock
(
Blockly
.
Msg
.
LANG_COMPONENT_BLOCK_SETTER_TITLE_SET
,
'
set
'
,
setters
[
k
],
var
filteredSetters
=
setters
.
filter
(
function
(
prop
)
{
return
!
deprecatedProperties
.
includes
(
prop
)})
var
filteredGetters
=
getters
.
filter
(
function
(
prop
)
{
return
!
deprecatedProperties
.
includes
(
prop
)})
for
(
k
=
0
;
k
<
filteredSetters
.
length
;
k
++
)
{
pushBlock
(
Blockly
.
Msg
.
LANG_COMPONENT_BLOCK_SETTER_TITLE_SET
,
'
set
'
,
filteredSetters
[
k
],
component
.
typeName
,
component
.
name
,
false
);
}
for
(
k
=
0
;
k
<
getters
.
length
;
k
++
)
{
pushBlock
(
''
,
'
get
'
,
g
etters
[
k
],
component
.
typeName
,
component
.
name
,
false
);
for
(
k
=
0
;
k
<
filteredGetters
.
length
;
k
++
)
{
pushBlock
(
''
,
'
get
'
,
filteredG
etters
[
k
],
component
.
typeName
,
component
.
name
,
false
);
}
for
(
k
=
0
;
k
<
setters
.
length
;
k
++
)
{
pushGenericBlock
(
Blockly
.
Msg
.
LANG_COMPONENT_BLOCK_SETTER_TITLE_SET
,
'
set
'
,
s
etters
[
k
],
for
(
k
=
0
;
k
<
filteredSetters
.
length
;
k
++
)
{
pushGenericBlock
(
Blockly
.
Msg
.
LANG_COMPONENT_BLOCK_SETTER_TITLE_SET
,
'
set
'
,
filteredS
etters
[
k
],
component
.
typeName
);
}
for
(
k
=
0
;
k
<
getters
.
length
;
k
++
)
{
pushGenericBlock
(
''
,
'
get
'
,
g
etters
[
k
],
component
.
typeName
);
for
(
k
=
0
;
k
<
filteredGetters
.
length
;
k
++
)
{
pushGenericBlock
(
''
,
'
get
'
,
filteredG
etters
[
k
],
component
.
typeName
);
}
});
...
...
appinventor/blocklyeditor/src/component_database.js
View file @
0b42cb2a
...
...
@@ -688,7 +688,8 @@ Blockly.ComponentDatabase.prototype.getEventForType = function(typeName, eventNa
*/
Blockly
.
ComponentDatabase
.
prototype
.
forEventInType
=
function
(
typeName
,
callback
)
{
if
(
typeName
in
this
.
types_
)
{
goog
.
object
.
map
(
this
.
types_
[
typeName
].
eventDictionary
,
callback
);
var
filterDeprecated
=
goog
.
object
.
filter
(
this
.
types_
[
typeName
].
eventDictionary
,
function
(
event
)
{
return
!
event
.
deprecated
;
});
goog
.
object
.
map
(
filterDeprecated
,
callback
);
}
};
...
...
@@ -720,7 +721,8 @@ Blockly.ComponentDatabase.prototype.getMethodForType = function(typeName, method
*/
Blockly
.
ComponentDatabase
.
prototype
.
forMethodInType
=
function
(
typeName
,
callback
)
{
if
(
typeName
in
this
.
types_
)
{
goog
.
object
.
map
(
this
.
types_
[
typeName
].
methodDictionary
,
callback
);
var
filterDeprecated
=
goog
.
object
.
filter
(
this
.
types_
[
typeName
].
methodDictionary
,
function
(
method
)
{
return
!
method
.
deprecated
;
});
goog
.
object
.
map
(
filterDeprecated
,
callback
);
}
};
...
...
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