internal ClassInfo AddClass(ClassDefinition node, AnalysisUnit outerUnit) { InterpreterScope scope; var declScope = outerUnit.InterpreterScope; if (!declScope.TryGetNodeScope(node, out scope)) { if (node.Body == null || node.Name == null) { return(null); } var unit = new ClassAnalysisUnit(node, declScope, outerUnit); var classScope = (ClassScope)unit.Scope; var classVar = declScope.AddLocatedVariable(node.Name, node.NameExpression, unit); if (node.Decorators == null || node.Decorators.Decorators.Length == 0) { classVar.AddTypes(unit, classScope.Class.SelfSet); } declScope.Children.Add(classScope); declScope.AddNodeScope(node, classScope); unit.Enqueue(); scope = classScope; } return(scope.AnalysisValue as ClassInfo); }
internal ClassInfo AddClass(ClassDefinition node, AnalysisUnit outerUnit) { InterpreterScope scope; var declScope = outerUnit.Scope; if (!declScope.TryGetNodeScope(node, out scope)) { if (node.Body == null || node.Name == null) { return null; } var unit = new ClassAnalysisUnit(node, declScope, outerUnit); var classScope = (ClassScope)unit.Scope; var classVar = declScope.AddLocatedVariable(node.Name, node.NameExpression, unit); classVar.AddTypes(unit, classScope.Class.SelfSet); declScope.Children.Add(classScope); declScope.AddNodeScope(node, classScope); unit.Enqueue(); scope = classScope; } return scope.AnalysisValue as ClassInfo; }