提交 707fac83 编写于 作者: S Steffen Forkmann

Extract function

上级 027f97b2
......@@ -155,6 +155,17 @@ let GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ =
let pinfos = pinfos |> List.filter (IsPropInfoAccessible g amap m ad)
pinfos
// Checks whether the given type has an indexer property.
let IsIndexerType g amap typ =
isArray1DTy g typ ||
isListTy g typ ||
match tryDestAppTy g typ with
| Some tcref ->
let _, entityTy = generalizeTyconRef tcref
let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) g amap range0 entityTy
props |> List.exists (fun x -> x.PropertyName = "Item")
| _ -> false
/// Sets of methods up the hierarchy, ignoring duplicates by name and sig.
/// Used to collect sets of virtual methods, protected methods, protected
......
......@@ -8225,18 +8225,7 @@ and Propagate cenv overallTy env tpenv (expr: ApplicableExpr) exprty delayed =
| SynExpr.ArrayOrListOfSeqExpr _ ->
// 'delayed' is about to be dropped on the floor, first do rudimentary checking to get name resolutions in its body
RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects_Delayed cenv env tpenv delayed
let flag =
let typ = expr.Type
isArray1DTy cenv.g typ ||
if isAppTy cenv.g typ then
let tcref = tcrefOfAppTy cenv.g typ
let _, entityTy = generalizeTyconRef tcref
let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy
props |> List.exists (fun x -> x.PropertyName = "Item")
else false
error (NotAFunction(denv,overallTy,flag,mExpr,mArg))
error (NotAFunction(denv,overallTy,IsIndexerType cenv.g cenv.amap expr.Type,mExpr,mArg))
| _ ->
// 'delayed' is about to be dropped on the floor, first do rudimentary checking to get name resolutions in its body
RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects_Delayed cenv env tpenv delayed
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册