Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lindexi_gd
Uno
提交
3da1a742
U
Uno
项目概览
lindexi_gd
/
Uno
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Uno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3da1a742
编写于
3月 30, 2023
作者:
J
Jérôme Laban
提交者:
GitHub
3月 30, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11840 from Youssef1313/generator-displaystring
perf: Fix few more occurrences of ToDisplayString
上级
51fc6bfa
f517a6a3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
24 deletion
+13
-24
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/Utils/XBindExpressionParser.cs
...ceGenerators/XamlGenerator/Utils/XBindExpressionParser.cs
+2
-3
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs
...eGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs
+9
-10
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
...no.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
+2
-11
未找到文件。
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/Utils/XBindExpressionParser.cs
浏览文件 @
3da1a742
...
...
@@ -143,7 +143,7 @@ namespace Uno.UI.SourceGenerators.XamlGenerator.Utils
return
typeName
;
}
return
typeSymbol
.
ToDisplayString
(
SymbolDisplayFormat
.
FullyQualifiedFormat
);
return
typeSymbol
.
GetFullyQualifiedTypeIncludingGlobal
(
);
}
public
override
SyntaxNode
?
VisitIdentifierName
(
IdentifierNameSyntax
node
)
...
...
@@ -197,8 +197,7 @@ namespace Uno.UI.SourceGenerators.XamlGenerator.Utils
{
_contextName
=
contextName
;
_contextTypeSymbol
=
contextTypeSymbol
;
// TODO: Modify after https://github.com/unoplatform/uno/pull/11531 is merged.
_contextTypeString
=
contextTypeSymbol
.
ToDisplayString
(
SymbolDisplayFormat
.
FullyQualifiedFormat
);
_contextTypeString
=
contextTypeSymbol
.
GetFullyQualifiedTypeIncludingGlobal
();
// We need to take globalNamespace from the compilation itself.
// Walking ContainingNamespaces from contextTypeSymbol or
...
...
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs
浏览文件 @
3da1a742
...
...
@@ -30,8 +30,7 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
record
XClassName
(
string
Namespace
,
string
ClassName
,
INamedTypeSymbol
?
Symbol
)
{
public
override
string
ToString
()
=>
Symbol
?.
ToDisplayString
(
SymbolDisplayFormat
.
FullyQualifiedFormat
.
WithGlobalNamespaceStyle
(
SymbolDisplayGlobalNamespaceStyle
.
Included
))
??
Namespace
+
"."
+
ClassName
;
=>
Symbol
?.
GetFullyQualifiedTypeIncludingGlobal
()
??
Namespace
+
"."
+
ClassName
;
}
private
void
InitCaches
()
...
...
@@ -73,16 +72,16 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
private
string
GetGlobalizedTypeName
(
XamlType
type
)
{
var
fullTypeName
=
type
.
Name
;
var
knownType
=
FindType
(
type
);
if
(
knownType
==
null
&&
type
.
PreferredXamlNamespace
.
StartsWith
(
"using:"
,
StringComparison
.
Ordinal
)
)
if
(
knownType
is
not
null
)
{
fullTypeName
=
type
.
PreferredXamlNamespace
.
TrimStart
(
"using:"
)
+
"."
+
type
.
Name
;
return
knownType
.
GetFullyQualifiedTypeIncludingGlobal
()
;
}
if
(
knownType
!=
null
)
var
fullTypeName
=
type
.
Name
;
if
(
type
.
PreferredXamlNamespace
.
StartsWith
(
"using:"
,
StringComparison
.
Ordinal
))
{
// Override the using with the type that was found in the list of loaded assemblies
fullTypeName
=
knownType
.
ToDisplayString
();
fullTypeName
=
type
.
PreferredXamlNamespace
.
Substring
(
"using:"
.
Length
)
+
"."
+
type
.
Name
;
}
return
GetGlobalizedTypeName
(
fullTypeName
);
...
...
@@ -444,7 +443,7 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
}
var
setMethod
=
type
?.
GetFirstMethodWithName
(
"Set"
+
name
);
if
(
setMethod
is
{
IsStatic
:
true
,
Parameters
:
{
Length
:
2
}
})
if
(
setMethod
is
{
IsStatic
:
true
,
Parameters
.
Length
:
2
})
{
return
true
;
}
...
...
@@ -944,6 +943,6 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
private
bool
IsTypeImplemented
(
INamedTypeSymbol
type
)
=>
_isTypeImplemented
(
type
);
private
static
bool
SourceIsTypeImplemented
(
INamedTypeSymbol
type
)
=>
type
.
GetAttributes
().
None
(
a
=>
a
.
AttributeClass
?.
ToDisplayString
()
==
XamlConstants
.
Types
.
NotImplementedAttribute
);
=>
type
.
GetAttributes
().
None
(
a
=>
a
.
AttributeClass
?.
GetFullyQualifiedTypeExcludingGlobal
()
==
XamlConstants
.
Types
.
NotImplementedAttribute
);
}
}
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
浏览文件 @
3da1a742
...
...
@@ -2,7 +2,6 @@
using
Uno.Extensions
;
using
Uno.MsBuildTasks.Utils
;
using
Uno.MsBuildTasks.Utils.XamlPathParser
;
using
Uno.UI.SourceGenerators.XamlGenerator.Utils
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -22,7 +21,6 @@ using System.Diagnostics;
using
System.Diagnostics.CodeAnalysis
;
using
Uno.UI.SourceGenerators.Helpers
;
using
System.Collections.Immutable
;
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
System.Text
;
using
Microsoft.CodeAnalysis.Text
;
...
...
@@ -1108,7 +1106,6 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
using
(
writer
.
BlockInvariant
(
$"Loading += (s, e) => "
))
{
if
(
_isHotReloadEnabled
&&
_xClassName
.
Symbol
!=
null
)
{
writer
.
AppendLineIndented
(
$"var __that = global::Uno.UI.Helpers.MarkupHelper.GetElementProperty<
{
_xClassName
.
Symbol
?.
GetFullyQualifiedTypeIncludingGlobal
()}
>(s, \"owner\");"
);
}
...
...
@@ -3693,18 +3690,12 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
}
// Local function used to build a property/value for any custom MarkupExtensions
void
BuildCustomMarkupExtensionPropertyValue
(
IIndentedStringBuilder
writer
,
XamlMemberDefinition
member
,
string
?
closure
=
null
)
void
BuildCustomMarkupExtensionPropertyValue
(
IIndentedStringBuilder
writer
,
XamlMemberDefinition
member
,
string
closure
)
{
Func
<
string
,
string
>
formatLine
=
assignment
=>
!
closure
.
IsNullOrEmpty
()
?
$"
{
closure
}
.
{
assignment
}
;\r\n"
:
assignment
;
var
propertyValue
=
GetCustomMarkupExtensionValue
(
member
,
closure
);
if
(!
propertyValue
.
IsNullOrEmpty
())
{
var
formatted
=
formatLine
(
$"
{
member
.
Member
.
Name
}
=
{
propertyValue
}
"
);
writer
.
AppendIndented
(
formatted
);
writer
.
AppendIndented
(
$"
{
closure
}
.
{
member
.
Member
.
Name
}
=
{
propertyValue
}
;\r\n"
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录