private GlobalScope CreateGlobalScope(Vector <Class> classes, Vector <Function> functions) { var globals = new GlobalScope(); foreach (var @class in classes) { if (!globals.TryIncludeUniqueBinding(@class.Name.Identifier, ConstructorType(@class.Name))) { LogError(CompilerError.DuplicateIdentifier(@class.Position, @class)); } } foreach (var function in functions) { if (!globals.TryIncludeUniqueBinding(function.Name.Identifier, typeRegistry.DeclaredType(function))) { LogError(CompilerError.DuplicateIdentifier(function.Position, function)); } } return(globals); }
private GlobalScope CreateGlobalScope(Vector<Class> classes, Vector<Function> functions) { var globals = new GlobalScope(); foreach (var @class in classes) if (!globals.TryIncludeUniqueBinding(@class.Name.Identifier, ConstructorType(@class.Name))) LogError(CompilerError.DuplicateIdentifier(@class.Position, @class)); foreach (var function in functions) if (!globals.TryIncludeUniqueBinding(function.Name.Identifier, typeRegistry.DeclaredType(function))) LogError(CompilerError.DuplicateIdentifier(function.Position, function)); return globals; }