Beispiel #1
0
 public List<BoundCompilationUnit> CreateBasicModel(List<CompilationUnitSyntax> compilationUnitSyntax)
 {
     var compilationUnits = new List<BoundCompilationUnit>();
     foreach (var unitSyntax in compilationUnitSyntax)
     {
         var boundCompilationUnit = new BoundCompilationUnit(unitSyntax);
         foreach (var namespaceSyntax in unitSyntax.Namespaces)
         {
             var boundNamespace = new BoundNamespace(namespaceSyntax.Name.Value, namespaceSyntax);
             boundCompilationUnit.Namespaces.Add(boundNamespace);
             foreach (var classSyntax in namespaceSyntax.Classes)
             {
                 var boundType = new BoundType(classSyntax.Name.Value, classSyntax);
                 boundType.FieldsInternal.AddRange(
                     classSyntax.Fields.Select(x => new BoundField(x.Name.Value, x)));
                 boundType.FunctionsInternal.AddRange(
                     classSyntax.Functions.Select(x => new BoundFunction(x.Name.Value, x)));
                boundNamespace.TypesInternal.Add(boundType);
             }
             boundNamespace.EnumsInternal.AddRange(
                 namespaceSyntax.Enums.Select(x => new BoundEnum(x.EnumName.Value, x)));
         }
         compilationUnits.Add(boundCompilationUnit);
     }
     return compilationUnits;
 }
Beispiel #2
0
 public void ExitClass()
 {
     _currentClass = null;
 }
Beispiel #3
0
 public void EnterClass(BoundType @class)
 {
     _currentClass = @class;
 }
Beispiel #4
0
 private void BindClass(BoundType @class, ClassSyntax syntax)
 {
     _contextService.EnterClass(@class);
     foreach (var boundField in @class.FieldsInternal)
     {
         BindField(boundField, (FieldSyntax)boundField.Syntax);
     }
     foreach (var boundFunction in @class.FunctionsInternal)
     {
         _contextService.EnterScope();
         BindFunction(boundFunction, (FunctionSyntax)boundFunction.Syntax);
         _contextService.ExitScope();
     }
     @class.ConstructorsInternal.AddRange(syntax.Constructors.Select(BindConstructor).ToList());
     _contextService.ExitClass();
 }