Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
1e054c34
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1e054c34
编写于
2月 14, 2018
作者:
J
Jacob Richman
提交者:
GitHub
2月 14, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stop using ClassHierarchy.deprecated_incremental. (#4678)
* Stop using ClassHierarchy.deprecated_incremental.
上级
03a59835
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
11 deletion
+31
-11
flutter_kernel_transformers/lib/track_widget_constructor_locations.dart
..._transformers/lib/track_widget_constructor_locations.dart
+31
-11
未找到文件。
flutter_kernel_transformers/lib/track_widget_constructor_locations.dart
浏览文件 @
1e054c34
...
...
@@ -186,7 +186,7 @@ class _WidgetCallSiteTransformer extends Transformer {
bool
_isSubclassOfWidget
(
Class
clazz
)
{
// TODO(jacobr): use hierarchy.isSubclassOf once we are using the
// non-deprecated ClassHierarchy constructor.
return
_hierarchy
.
getClassAsInstanceOf
(
clazz
,
_widgetClass
)
!=
null
;
return
_hierarchy
.
isSubclassOf
(
clazz
,
_widgetClass
)
;
}
@override
...
...
@@ -236,7 +236,7 @@ class _WidgetCallSiteTransformer extends Transformer {
// TODO(jacobr): use hierarchy.isSubclassOf once we are using the
// non-deprecated ClassHierarchy constructor.
if
(
_currentFactory
!=
null
&&
_hierarchy
.
getClassAsInstanceOf
(
constructedClass
,
_currentFactory
.
enclosingClass
)
!=
null
)
{
_hierarchy
.
isSubclassOf
(
constructedClass
,
_currentFactory
.
enclosingClass
)
)
{
final
VariableDeclaration
creationLocationParameter
=
_getNamedParameter
(
_currentFactory
.
function
,
_creationLocationParameterName
,
...
...
@@ -278,6 +278,7 @@ class _WidgetCallSiteTransformer extends Transformer {
}
}
/// Rewrites all widget constructors and constructor invocations to add a
/// parameter specifying the location the constructor was called from.
///
...
...
@@ -414,7 +415,25 @@ class WidgetCreatorTracker {
// Add named parameters to all constructors.
clazz
.
constructors
.
forEach
(
handleConstructor
);
hierarchy
.
applyChanges
(<
Class
>[
clazz
]);
}
Program
_computeFullProgram
(
Program
deltaProgram
)
{
final
Set
<
Library
>
libraries
=
new
Set
<
Library
>();
final
List
<
Library
>
workList
=
<
Library
>[];
for
(
Library
library
in
deltaProgram
.
libraries
)
{
if
(
libraries
.
add
(
library
))
{
workList
.
add
(
library
);
}
}
while
(
workList
.
isNotEmpty
)
{
final
Library
library
=
workList
.
removeLast
();
for
(
LibraryDependency
dependency
in
library
.
dependencies
)
{
if
(
libraries
.
add
(
dependency
.
targetLibrary
))
{
workList
.
add
(
dependency
.
targetLibrary
);
}
}
}
return
new
Program
()..
libraries
.
addAll
(
libraries
);
}
/// Transform the given [program].
...
...
@@ -423,10 +442,6 @@ class WidgetCreatorTracker {
/// performing a hot reload.
void
transform
(
Program
program
)
{
final
List
<
Library
>
libraries
=
program
.
libraries
;
// TODO(jacobr): switch to the non-deprecated ClassHierarchy constructor
// once https://github.com/dart-lang/sdk/issues/32079 is fixed.
// ignore: deprecated_member_use
hierarchy
=
new
ClassHierarchy
.
deprecated_incremental
(
program
);
if
(
libraries
.
isEmpty
)
{
return
;
...
...
@@ -439,6 +454,14 @@ class WidgetCreatorTracker {
return
;
}
// TODO(jacobr): once there is a working incremental ClassHierarchy
// constructor switch to using it instead of building a ClassHierarchy off
// the full program.
hierarchy
=
new
ClassHierarchy
(
_computeFullProgram
(
program
),
onAmbiguousSupertypes:
(
Class
cls
,
Supertype
a
,
Supertype
b
)
{
},
);
final
Set
<
Class
>
transformedClasses
=
new
Set
<
Class
>.
identity
();
final
Set
<
Library
>
librariesToTransform
=
new
Set
<
Library
>.
identity
()
..
addAll
(
libraries
);
...
...
@@ -455,9 +478,6 @@ class WidgetCreatorTracker {
);
}
}
// Given the hierarchy we are using and the transforms we are applying,
// calling this method probably isn't really necessary.
hierarchy
.
applyChanges
(
transformedClasses
);
// Transform call sites to pass the location parameter.
final
_WidgetCallSiteTransformer
callsiteTransformer
=
...
...
@@ -481,7 +501,7 @@ class WidgetCreatorTracker {
}
// TODO(jacobr): use hierarchy.isSubclassOf once we are using the
// non-deprecated ClassHierarchy constructor.
return
hierarchy
.
getClassAsInstanceOf
(
clazz
,
_widgetClass
)
!=
null
;
return
hierarchy
.
isSubclassOf
(
clazz
,
_widgetClass
)
;
}
void
_transformWidgetConstructors
(
Set
<
Library
>
librariesToBeTransformed
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录