OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 'package:front_end/src/fasta/scanner.dart' show Token; | 5 import 'package:front_end/src/fasta/scanner.dart' show Token; |
6 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens | 6 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens |
7 show IDENTIFIER_TOKEN, KEYWORD_TOKEN, PLUS_TOKEN; | 7 show IDENTIFIER_TOKEN, KEYWORD_TOKEN, PLUS_TOKEN; |
8 import '../util/util.dart'; | 8 import '../util/util.dart'; |
9 import 'nodes.dart'; | 9 import 'nodes.dart'; |
10 | 10 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 if (spaces) space(); | 379 if (spaces) space(); |
380 visit(link.head); | 380 visit(link.head); |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 unparseNodeList(NodeList node, {bool spaces: true}) { | 384 unparseNodeList(NodeList node, {bool spaces: true}) { |
385 addToken(node.beginToken); | 385 addToken(node.beginToken); |
386 if (node.nodes != null) { | 386 if (node.nodes != null) { |
387 unparseNodeListFrom(node, node.nodes, spaces: spaces); | 387 unparseNodeListFrom(node, node.nodes, spaces: spaces); |
388 } | 388 } |
389 // if "[]" then beginToken == endToken ... only write beginToken | 389 if (node.endToken != null) write(node.endToken.lexeme); |
390 if (node.endToken != null && node.endToken != node.beginToken) { | |
391 write(node.endToken.lexeme); | |
392 } | |
393 } | 390 } |
394 | 391 |
395 visitNodeList(NodeList node) { | 392 visitNodeList(NodeList node) { |
396 unparseNodeList(node); | 393 unparseNodeList(node); |
397 } | 394 } |
398 | 395 |
399 visitOperator(Operator node) { | 396 visitOperator(Operator node) { |
400 visitIdentifier(node); | 397 visitIdentifier(node); |
401 } | 398 } |
402 | 399 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 } | 909 } |
913 | 910 |
914 visitStringNode(StringNode node) { | 911 visitStringNode(StringNode node) { |
915 throw 'internal error'; // Should not be called. | 912 throw 'internal error'; // Should not be called. |
916 } | 913 } |
917 | 914 |
918 visitTypeAnnotation(TypeAnnotation node) { | 915 visitTypeAnnotation(TypeAnnotation node) { |
919 throw 'internal error'; // Should not be called. | 916 throw 'internal error'; // Should not be called. |
920 } | 917 } |
921 } | 918 } |
OLD | NEW |