This commit is contained in:
parent
e758c710ba
commit
459d5c6185
|
|
@ -101,7 +101,31 @@ namespace CodeCompletion
|
|||
var id = new ident_with_templateparams();
|
||||
ntr.Add(new ident(s));
|
||||
foreach (var gen_td in tn.instance_params)
|
||||
ttr.params_list.Add(BuildSyntaxNodeForTypeReference(gen_td));
|
||||
{
|
||||
if (gen_td.PrintableName.StartsWith("AnonymousType#"))
|
||||
{
|
||||
SymScope tmp = cur_scope;
|
||||
TypeScope ts = null;
|
||||
cur_scope = ts = new TypeScope(SymbolKind.Class, cur_scope, null);
|
||||
tmp.AddName(gen_td.PrintableName, cur_scope);
|
||||
ts.loc = get_location(gen_td.location);
|
||||
ts.si = new SymInfo("class", SymbolKind.Class, "");
|
||||
foreach (var field in (gen_td as common_type_node).fields)
|
||||
{
|
||||
ElementScope es = new ElementScope();
|
||||
es.si = new SymInfo(field.name, SymbolKind.Property, "");
|
||||
BuildSyntaxNodeForTypeReference(field.type).visit(this);
|
||||
es.sc = returned_scope;
|
||||
ts.AddName(field.name, es);
|
||||
}
|
||||
returned_scope = cur_scope;
|
||||
cur_scope = tmp;
|
||||
ttr.params_list.Add(new named_type_reference(gen_td.PrintableName));
|
||||
}
|
||||
else
|
||||
ttr.params_list.Add(BuildSyntaxNodeForTypeReference(gen_td));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return ttr;
|
||||
|
|
@ -177,7 +201,8 @@ namespace CodeCompletion
|
|||
}
|
||||
else
|
||||
{
|
||||
if (tn.full_name.IndexOf("$") != -1 || tn.full_name.IndexOf("#") != -1)
|
||||
|
||||
if (tn.full_name.IndexOf("$") != -1 || tn.full_name.IndexOf("#") != -1 && tn.full_name.IndexOf("AnonymousType#") == -1)
|
||||
return ts;
|
||||
if (ts is FileScope && tn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.typed_file)
|
||||
return ts;
|
||||
|
|
@ -193,6 +218,22 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
/*private TypeScope CreateTypeScopeBySemanticType(type_node tn)
|
||||
{
|
||||
if (tn is common_generic_instance_type_node)
|
||||
{
|
||||
var ts = new TypeScope();
|
||||
var gitn = tn as common_generic_instance_type_node;
|
||||
ts.gener
|
||||
foreach (var field in gitn.fields)
|
||||
{
|
||||
ts.AddName(field.name, CreateTypeScopeBySemanticType(field.type));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
|
||||
private void CorrectVariableType(var_definition_node vdn)
|
||||
{
|
||||
location loc = null;
|
||||
|
|
@ -761,7 +802,7 @@ namespace CodeCompletion
|
|||
}
|
||||
// if (si == null) dn = compiled_type_node.get_type_node(PascalABCCompiler.NetHelper.NetHelper.FindType((_var_def_statement.vars_type as named_type_reference).names[0].name,unl));
|
||||
|
||||
if (returned_scope == null) return;
|
||||
//if (returned_scope == null) return;
|
||||
if (returned_scope is ProcScope)
|
||||
{
|
||||
returned_scope = new ProcType(returned_scope as ProcScope);
|
||||
|
|
@ -773,6 +814,8 @@ namespace CodeCompletion
|
|||
SymInfo si = new SymInfo(s.name, SymbolKind.Variable, s.name);
|
||||
if (cur_scope is TypeScope) si.kind = SymbolKind.Field;
|
||||
if (_var_def_statement.is_event) si.kind = SymbolKind.Event;
|
||||
if (returned_scope == null && false)
|
||||
returned_scope = new UnknownScope(new SymInfo("",SymbolKind.Class, ""));
|
||||
ElementScope es = new ElementScope(si, returned_scope, cur_scope);
|
||||
if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_var_def_statement))
|
||||
es.AddDocumentation(this.converter.controller.docs[_var_def_statement]);
|
||||
|
|
|
|||
|
|
@ -994,7 +994,7 @@ namespace PascalABCCompiler.Parsers
|
|||
if (sc is IProcScope) return "";
|
||||
if (sc is ITypeScope)
|
||||
{
|
||||
return sc.Name+(((sc as ITypeScope).TemplateArguments != null && !sc.Name.EndsWith("<>"))?"<>":"")+".";
|
||||
return sc.Name+(((sc as ITypeScope).TemplateArguments != null && !sc.Name.EndsWith("<>") && sc.Name != "class")?"<>":"")+".";
|
||||
}
|
||||
return sc.Name + ".";
|
||||
}
|
||||
|
|
@ -1478,7 +1478,7 @@ namespace PascalABCCompiler.Parsers
|
|||
type_name = type_name.Substring(1, type_name.Length - 1);
|
||||
switch (scope.ElemKind)
|
||||
{
|
||||
case SymbolKind.Variable: sb.Append("var " + GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name); break;
|
||||
case SymbolKind.Variable: sb.Append("var " + GetTopScopeName(scope.TopScope) + scope.Name + ((type_name != "")?": " + type_name:"")); break;
|
||||
case SymbolKind.Parameter: sb.Append(kind_of_param(scope) + "parameter " + scope.Name + ": " + type_name + (scope.ConstantValue != null ? (":=" + scope.ConstantValue.ToString()) : "")); break;
|
||||
case SymbolKind.Constant:
|
||||
{
|
||||
|
|
|
|||
3
TestSuite/intellisense_tests/autoclass4.pas
Normal file
3
TestSuite/intellisense_tests/autoclass4.pas
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
###
|
||||
var a{@var a: sequence of class;@} := (1..18).Sel(i->new class(f := i, g := i.ToS));
|
||||
var x{@var x: string;@} := a.First().g;
|
||||
|
|
@ -12,5 +12,6 @@ begin
|
|||
var t := f1{@function f1(): (byte,byte);@};
|
||||
var b{@var b: byte;@} := t.Item1;
|
||||
var t1 := f2;
|
||||
var i{@@} := t1.Item1;
|
||||
var i{@var i;@} := t1.Item1;
|
||||
var j{@var j;@} := i;
|
||||
end.
|
||||
|
|
@ -17971,7 +17971,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|| syntax_statement is procedure_call || syntax_statement is raise_statement)
|
||||
{
|
||||
|
||||
if (!(new LambdaSearcher(syntax_statement).CheckIfContainsLambdas()))
|
||||
if (lambdaProcessingState != LambdaProcessingState.TypeInferencePhase && !(new LambdaSearcher(syntax_statement).CheckIfContainsLambdas()))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue