LCOV - code coverage report
Current view: top level - src/torque - server-data.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 9 9 100.0 %
Date: 2019-04-17 Functions: 4 4 100.0 %

          Line data    Source code
       1             : // Copyright 2019 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #include "src/torque/server-data.h"
       6             : 
       7             : namespace v8 {
       8             : namespace internal {
       9             : namespace torque {
      10             : 
      11          23 : DEFINE_CONTEXTUAL_VARIABLE(LanguageServerData)
      12             : 
      13           6 : void LanguageServerData::AddDefinition(SourcePosition token,
      14             :                                        SourcePosition definition) {
      15           6 :   Get().definitions_map_[token.source].emplace_back(token, definition);
      16           6 : }
      17             : 
      18           5 : base::Optional<SourcePosition> LanguageServerData::FindDefinition(
      19             :     SourceId source, LineAndColumn pos) {
      20          12 :   for (const DefinitionMapping& mapping : Get().definitions_map_.at(source)) {
      21           6 :     SourcePosition current = mapping.first;
      22           6 :     if (current.Contains(pos)) return mapping.second;
      23             :   }
      24             : 
      25             :   return base::nullopt;
      26             : }
      27             : 
      28             : }  // namespace torque
      29             : }  // namespace internal
      30       59456 : }  // namespace v8

Generated by: LCOV version 1.10