Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
811c62b8
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
811c62b8
编写于
4月 06, 2022
作者:
D
Don Syme
提交者:
GitHub
4月 06, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cleanup (#12950)
上级
ce094be6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
16 deletion
+22
-16
src/fsharp/pars.fsy
src/fsharp/pars.fsy
+19
-16
tests/service/ProjectAnalysisTests.fs
tests/service/ProjectAnalysisTests.fs
+3
-0
未找到文件。
src/fsharp/pars.fsy
浏览文件 @
811c62b8
...
...
@@ -2867,49 +2867,52 @@ hardwhiteDefnBindingsTerminator:
/* An 'extern' DllImport function definition in C-style syntax */
cPrototype:
| EXTERN cRetType opt_access ident opt_HIGH_PRECEDENCE_APP LPAREN
c
Args rparen
| EXTERN cRetType opt_access ident opt_HIGH_PRECEDENCE_APP LPAREN
extern
Args rparen
{ let rty, vis, nm, args = $2, $3, $4, $7
let nmm = rhs parseState 3
let argsm = rhs parseState 6
let mBindLhs = lhs parseState
let mWhole = lhs parseState
let mRhs = lhs parseState
let rhsExpr = SynExpr.App (ExprAtomicFlag.NonAtomic,
false,
SynExpr.Ident (ident("failwith", rhs parseState 6)),
SynExpr.Const (SynConst.String("extern was not given a DllImport attribute", SynStringKind.Regular, rhs parseState 8), rhs parseState 8),
mRhs)
let rhsExpr =
SynExpr.App (
ExprAtomicFlag.NonAtomic,
false,
SynExpr.Ident (ident("failwith", rhs parseState 6)),
SynExpr.Const (SynConst.String("extern was not given a DllImport attribute", SynStringKind.Regular, rhs parseState 8), rhs parseState 8),
mRhs)
(fun attrs _ ->
let bindingPat = SynPat.LongIdent (LongIdentWithDots([nm], []), None, None, Some noInferredTypars, SynArgPats.Pats [SynPat.Tuple(false, args, argsm)], vis, nmm)
let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range)
let xmlDoc = grabXmlDoc(parseState, attrs, 1)
let binding = mkSynBinding
(xmlDoc, bindingPat)
(vis, false, false, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, Some rty, rhsExpr, mRhs, [], attrs, None, SynBindingTrivia.Zero)
let binding =
mkSynBinding
(xmlDoc, bindingPat)
(vis, false, false, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, Some rty, rhsExpr, mRhs, [], attrs, None, SynBindingTrivia.Zero)
[], [binding]) }
/* A list of arguments in an 'extern' DllImport function definition */
c
Args:
|
c
MoreArgs
extern
Args:
|
extern
MoreArgs
{ List.rev $1 }
|
c
Arg
|
extern
Arg
{ [$1] }
|
{ [] }
/* Part of the list of arguments in an 'extern' DllImport function definition */
c
MoreArgs:
|
cMoreArgs COMMA c
Arg
extern
MoreArgs:
|
externMoreArgs COMMA extern
Arg
{ $3 :: $1 }
|
cArg COMMA c
Arg
|
externArg COMMA extern
Arg
{ [$3; $1] }
/* A single argument in an 'extern' DllImport function definition */
c
Arg:
extern
Arg:
| opt_attributes cType
{ let m = lhs parseState in SynPat.Typed(SynPat.Wild m, $2, m) |> addAttribs $1 }
...
...
tests/service/ProjectAnalysisTests.fs
浏览文件 @
811c62b8
...
...
@@ -5287,16 +5287,19 @@ let foo (a: Foo): bool =
let
``Test typed AST for struct unions``
()
=
// See https://github.com/fsharp/FSharp.Compiler.Service/issues/756
let
keepAssemblyContentsChecker
=
FSharpChecker
.
Create
(
keepAssemblyContents
=
true
)
let
wholeProjectResults
=
keepAssemblyContentsChecker
.
ParseAndCheckProject
(
ProjectStructUnions
.
options
)
|>
Async
.
RunImmediate
let
declarations
=
let
checkedFile
=
wholeProjectResults
.
AssemblyContents
.
ImplementationFiles
.[
0
]
match
checkedFile
.
Declarations
.[
0
]
with
|
FSharpImplementationFileDeclaration
.
Entity
(_,
subDecls
)
->
subDecls
|
_
->
failwith
"unexpected declaration"
let
getExpr
exprIndex
=
match
declarations
.[
exprIndex
]
with
|
FSharpImplementationFileDeclaration
.
MemberOrFunctionOrValue
(_,_,
e
)
->
e
|
FSharpImplementationFileDeclaration
.
InitAction
e
->
e
|
_
->
failwith
"unexpected declaration"
match
getExpr
(
declarations
.
Length
-
1
)
with
|
IfThenElse
(
UnionCaseTest
(
AddressOf
(
UnionCaseGet
_),_,
uci
),
Const
(
true
Value
,
_),
Const
(
false
Value
,
_))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录