public NestedFunctionData(NestedFunctionData parent) { Parent = parent; DirectlyUsedVariables = new HashSet <IVariable>(); DirectlyDeclaredVariables = new HashSet <IVariable>(); NestedFunctions = new List <NestedFunctionData>(); }
private void VisitNestedFunction(AstNode node, AstNode body) { var parentFunction = currentFunction; currentFunction = new NestedFunctionData(parentFunction) { DefinitionNode = node, BodyNode = body, ResolveResult = (LambdaResolveResult)_resolver.Resolve(node) }; body.AcceptVisitor(this); parentFunction.NestedFunctions.Add(currentFunction); currentFunction = parentFunction; }
public NestedFunctionData GatherNestedFunctions(AstNode node) { currentFunction = new NestedFunctionData(null) { DefinitionNode = node, BodyNode = GetBodyNode(node), ResolveResult = _resolver.Resolve(node) as LambdaResolveResult }; VisitChildren(node); return(currentFunction); }
private void VisitNestedFunction(AstNode node, AstNode body) { var parentFunction = currentFunction; currentFunction = new NestedFunctionData(parentFunction) { DefinitionNode = node, BodyNode = body, ResolveResult = (LambdaResolveResult)_resolver.Resolve(node) }; body.AcceptVisitor(this); parentFunction.NestedFunctions.Add(currentFunction); currentFunction = parentFunction; }
private void CreateCompilationContext(AstNode entity, IMethod method, ITypeDefinition type, string thisAlias) { _usedNames = method != null ? new HashSet <string>(method.DeclaringTypeDefinition.TypeParameters.Concat(method.TypeParameters).Select(p => _namer.GetTypeParameterName(p))) : new HashSet <string>(); if (entity != null) { var x = new VariableGatherer(_resolver, _namer, _errorReporter).GatherVariables(entity, method, _usedNames); variables = x.Item1; _usedNames = x.Item2; } nestedFunctionsRoot = entity != null ? new NestedFunctionGatherer(_resolver).GatherNestedFunctions(entity, variables) : new NestedFunctionData(null); var nestedFunctionsDict = new[] { nestedFunctionsRoot }.Concat(nestedFunctionsRoot.DirectlyOrIndirectlyNestedFunctions).Where(f => f.ResolveResult != null).ToDictionary(f => f.ResolveResult); _statementCompiler = new StatementCompiler(_metadataImporter, _namer, _errorReporter, _compilation, _resolver, variables, nestedFunctionsDict, _runtimeLibrary, thisAlias, _usedNames, null, method, type); }
public NestedFunctionData GatherNestedFunctions(AstNode node) { currentFunction = new NestedFunctionData(null) { DefinitionNode = node, BodyNode = GetBodyNode(node), ResolveResult = _resolver.Resolve(node) as LambdaResolveResult }; VisitChildren(node); return currentFunction; }
public NestedFunctionData(NestedFunctionData parent) { Parent = parent; DirectlyUsedVariables = new HashSet<IVariable>(); DirectlyDeclaredVariables = new HashSet<IVariable>(); NestedFunctions = new List<NestedFunctionData>(); }