Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commited948ab

Browse files
vladimaKevinRansom
authored andcommitted
[WIP] use Layout as a source data of classification related tasks (dotnet#2070)
* use Layout as a source data of classification related tasks* fix indentation* parse xml doc by hand instead of relying on VS service* revert back old API* fix portable build* fix output in FSI* fix printing of operators* update Surface test* internalize new types and modules* tag module/namespace as keywords* fix tooltip formatting for types with hidden representation* fix separator placement
1 parenta24a560 commited948ab

27 files changed

+2128
-1145
lines changed

‎src/fsharp/FSharp.Core/quotations.fs‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ open Microsoft.FSharp.Reflection
1818
openMicrosoft.FSharp.Core.Printf
1919
openMicrosoft.FSharp.Text.StructuredPrintfImpl
2020
openMicrosoft.FSharp.Text.StructuredPrintfImpl.LayoutOps
21+
openMicrosoft.FSharp.Text.StructuredPrintfImpl.TaggedTextOps
2122

2223
#nowarn"52"// The value has been copied to ensure the original is not mutated by this operation
2324

@@ -227,22 +228,23 @@ and [<CompiledName("FSharpExpr")>]
227228
letexpr(e:Expr)= e.GetLayout(long)
228229
letexprs(es:Expr list)= es|> List.map expr
229230
letparens ls= bracketL(commaListL ls)
230-
letpairL l1 l2= bracketL(l1^^ sepL","^^ l2)
231+
letpairL l1 l2= bracketL(l1^^ sepLLiterals.comma^^ l2)
231232
letlistL ls= squareBracketL(commaListL ls)
232-
letcombL nm ls= wordL nm^^ parens ls
233-
letnoneL= wordL"None"
234-
letsomeL e= combL"Some"[expr e]
235-
lettypeL(o:Type)= wordL(if longthen o.FullNameelse o.Name)
236-
letobjL(o:'T)= wordL(sprintf"%A" o)
237-
letvarL(v:Var)= wordL v.Name
233+
letcombTaggedL nm ls= wordL nm^^ parens ls
234+
letcombL nm ls= combTaggedL(tagKeyword nm) ls
235+
letnoneL= wordL(tagProperty"None")
236+
letsomeL e= combTaggedL(tagMethod"Some")[expr e]
237+
lettypeL(o:Type)= wordL(tagClass(if longthen o.FullNameelse o.Name))
238+
letobjL(o:'T)= wordL(tagText(sprintf"%A" o))
239+
letvarL(v:Var)= wordL(tagLocal v.Name)
238240
let(|E|)(e:Expr)= e.Tree
239241
let(|Lambda|_|)(E x)=match xwith LambdaTerm(a,b)-> Some(a,b)|_-> None
240242
let(|IteratedLambda|_|)(e:Expr)= qOneOrMoreRLinear(|Lambda|_|) e
241-
letucaseL(unionCase:UnionCaseInfo)=(if longthen objL unionCaseelse wordL unionCase.Name)
242-
letminfoL(minfo:MethodInfo)=if longthen objL minfoelse wordL minfo.Name
243-
letcinfoL(cinfo:ConstructorInfo)=if longthen objL cinfoelse wordL cinfo.DeclaringType.Name
244-
letpinfoL(pinfo:PropertyInfo)=if longthen objL pinfoelse wordL pinfo.Name
245-
letfinfoL(finfo:FieldInfo)=if longthen objL finfoelse wordL finfo.Name
243+
letucaseL(unionCase:UnionCaseInfo)=(if longthen objL unionCaseelse wordL(tagUnionCaseunionCase.Name))
244+
letminfoL(minfo:MethodInfo)=if longthen objL minfoelse wordL(tagMethodminfo.Name)
245+
letcinfoL(cinfo:ConstructorInfo)=if longthen objL cinfoelse wordL(tagMethodcinfo.DeclaringType.Name)
246+
letpinfoL(pinfo:PropertyInfo)=if longthen objL pinfoelse wordL(tagPropertypinfo.Name)
247+
letfinfoL(finfo:FieldInfo)=if longthen objL finfoelse wordL(tagFieldfinfo.Name)
246248
let rec(|NLambdas|_|)n(e:Expr)=
247249
match ewith
248250
|_when n<=0-> Some([],e)
@@ -259,7 +261,7 @@ and [<CompiledName("FSharpExpr")>]
259261
| CombTerm(UnionCaseTestOp(unionCase),args)-> combL"UnionCaseTest"(exprs args@[ucaseL unionCase])
260262
| CombTerm(NewTupleOp_,args)-> combL"NewTuple"(exprs args)
261263
| CombTerm(TupleGetOp(_,i),[arg])-> combL"TupleGet"([expr arg]@[objL i])
262-
| CombTerm(ValueOp(v,_,Some nm),[])-> combL"ValueWithName"[objL v; wordLnm]
264+
| CombTerm(ValueOp(v,_,Some nm),[])-> combL"ValueWithName"[objL v; wordL(tagLocal nm)]
263265
| CombTerm(ValueOp(v,_,None),[])-> combL"Value"[objL v]
264266
| CombTerm(WithValueOp(v,_),[defn])-> combL"WithValue"[objL v; expr defn]
265267
| CombTerm(InstanceMethodCallOp(minfo),obj::args)-> combL"Call"[someL obj; minfoL minfo; listL(exprs args)]
@@ -291,9 +293,9 @@ and [<CompiledName("FSharpExpr")>]
291293
| NLambdas n(vs,e)-> combL"NewDelegate"([typeL ty]@(vs|> List.map varL)@[expr e])
292294
|_-> combL"NewDelegate"[typeL ty; expr e]
293295
//| CombTerm(_,args) -> combL "??" (exprs args)
294-
| VarTerm(v)-> wordL v.Name
296+
| VarTerm(v)-> wordL(tagLocalv.Name)
295297
| LambdaTerm(v,b)-> combL"Lambda"[varL v; expr b]
296-
| HoleTerm_-> wordL"_"
298+
| HoleTerm_-> wordL(tagLocal"_")
297299
| CombTerm(QuoteOp_,args)-> combL"Quote"(exprs args)
298300
|_-> failwithf"Unexpected term in layout%A" x.Tree
299301

‎src/fsharp/MethodCalls.fs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@ let BuildFSharpMethodApp g m (vref: ValRef) vexp vexprty (args: Exprs) =
597597
match arity,argswith
598598
|(0|1),[]when typeEquiv g(domainOfFunTy g fty) g.unit_ty-> mkUnit g m,(args, rangeOfFunTy g fty)
599599
|0,(arg::argst)->
600-
warning(InternalError(sprintf"Unexpected zero arity, args =%s"(Layout.showL(Layout.sepListL(Layout.rightL";")(List.map exprL args))),m));
600+
601+
602+
warning(InternalError(sprintf"Unexpected zero arity, args =%s"(Layout.showL(Layout.sepListL(Layout.rightL(Layout.TaggedTextOps.tagText";"))(List.map exprL args))),m));
601603
arg,(argst, rangeOfFunTy g fty)
602604
|1,(arg:: argst)-> arg,(argst, rangeOfFunTy g fty)
603605
|1,[]-> error(InternalError("expected additional arguments here",m))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp