| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:convert'; | 5 import 'dart:convert'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 9 import 'package:analyzer/dart/ast/syntactic_entity.dart'; | 9 import 'package:analyzer/dart/ast/syntactic_entity.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // visit children | 423 // visit children |
| 424 _safelyVisit(node.documentationComment); | 424 _safelyVisit(node.documentationComment); |
| 425 _safelyVisitList(node.metadata); | 425 _safelyVisitList(node.metadata); |
| 426 _safelyVisit(node.parameters); | 426 _safelyVisit(node.parameters); |
| 427 _safelyVisitList(node.initializers); | 427 _safelyVisitList(node.initializers); |
| 428 _safelyVisit(node.body); | 428 _safelyVisit(node.body); |
| 429 }); | 429 }); |
| 430 } | 430 } |
| 431 | 431 |
| 432 @override | 432 @override |
| 433 visitDeclaredIdentifier(DeclaredIdentifier node) { |
| 434 // variable |
| 435 var variableVName = addNodeAndFacts(schema.VARIABLE_KIND, |
| 436 element: node.element, |
| 437 subKind: schema.LOCAL_SUBKIND, |
| 438 completeFact: schema.DEFINITION); |
| 439 |
| 440 // anchor |
| 441 addAnchorEdgesContainingEdge( |
| 442 syntacticEntity: node.identifier, |
| 443 edges: [ |
| 444 schema.DEFINES_BINDING_EDGE, |
| 445 ], |
| 446 target: variableVName, |
| 447 enclosingTarget: _enclosingVName); |
| 448 |
| 449 // type |
| 450 addEdge( |
| 451 variableVName, |
| 452 schema.TYPED_EDGE, |
| 453 _vNameFromType( |
| 454 resolutionMap.elementDeclaredByDeclaredIdentifier(node).type)); |
| 455 |
| 456 // no children |
| 457 } |
| 458 |
| 459 @override |
| 433 visitEnumConstantDeclaration(EnumConstantDeclaration node) { | 460 visitEnumConstantDeclaration(EnumConstantDeclaration node) { |
| 434 // constant node | 461 // constant node |
| 435 var constDeclVName = | 462 var constDeclVName = |
| 436 addNodeAndFacts(schema.CONSTANT_KIND, element: node.element); | 463 addNodeAndFacts(schema.CONSTANT_KIND, element: node.element); |
| 437 | 464 |
| 438 // anchor- defines/binding, defines | 465 // anchor- defines/binding, defines |
| 439 addAnchorEdgesContainingEdge( | 466 addAnchorEdgesContainingEdge( |
| 440 syntacticEntity: node.name, | 467 syntacticEntity: node.name, |
| 441 edges: [ | 468 edges: [ |
| 442 schema.DEFINES_BINDING_EDGE, | 469 schema.DEFINES_BINDING_EDGE, |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 } | 1415 } |
| 1389 | 1416 |
| 1390 @override | 1417 @override |
| 1391 StringBuffer visitTypeParameterElement(TypeParameterElement e) { | 1418 StringBuffer visitTypeParameterElement(TypeParameterElement e) { |
| 1392 // It is legal to have a named constructor with the same name as a type | 1419 // It is legal to have a named constructor with the same name as a type |
| 1393 // parameter. So we distinguish them by using '.' between the class (or | 1420 // parameter. So we distinguish them by using '.' between the class (or |
| 1394 // typedef) name and the type parameter name. | 1421 // typedef) name and the type parameter name. |
| 1395 return e.enclosingElement.accept(this)..write('.')..write(e.name); | 1422 return e.enclosingElement.accept(this)..write('.')..write(e.name); |
| 1396 } | 1423 } |
| 1397 } | 1424 } |
| OLD | NEW |