| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.ast_to_text; | 4 library kernel.ast_to_text; |
| 5 | 5 |
| 6 import '../ast.dart'; | 6 import '../ast.dart'; |
| 7 import '../import_table.dart'; | 7 import '../import_table.dart'; |
| 8 | 8 |
| 9 class Namer<T> { | 9 class Namer<T> { |
| 10 int index = 0; | 10 int index = 0; |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 endLine(); | 674 endLine(); |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 | 677 |
| 678 visitLibrary(Library node) {} | 678 visitLibrary(Library node) {} |
| 679 | 679 |
| 680 visitField(Field node) { | 680 visitField(Field node) { |
| 681 writeAnnotationList(node.annotations); | 681 writeAnnotationList(node.annotations); |
| 682 writeIndentation(); | 682 writeIndentation(); |
| 683 writeModifier(node.isStatic, 'static'); | 683 writeModifier(node.isStatic, 'static'); |
| 684 writeModifier(node.isCovariant, 'covariant'); |
| 684 writeModifier(node.isFinal, 'final'); | 685 writeModifier(node.isFinal, 'final'); |
| 685 writeModifier(node.isConst, 'const'); | 686 writeModifier(node.isConst, 'const'); |
| 686 // Only show implicit getter/setter modifiers in cases where they are | 687 // Only show implicit getter/setter modifiers in cases where they are |
| 687 // out of the ordinary. | 688 // out of the ordinary. |
| 688 if (node.isStatic) { | 689 if (node.isStatic) { |
| 689 writeModifier(node.hasImplicitGetter, '[getter]'); | 690 writeModifier(node.hasImplicitGetter, '[getter]'); |
| 690 writeModifier(node.hasImplicitSetter, '[setter]'); | 691 writeModifier(node.hasImplicitSetter, '[setter]'); |
| 691 } else { | 692 } else { |
| 692 writeModifier(!node.hasImplicitGetter, '[no-getter]'); | 693 writeModifier(!node.hasImplicitGetter, '[no-getter]'); |
| 693 if (node.isFinal) { | 694 if (node.isFinal) { |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 writeFunction(node.function, name: getVariableName(node.variable)); | 1413 writeFunction(node.function, name: getVariableName(node.variable)); |
| 1413 } else { | 1414 } else { |
| 1414 writeWord(getVariableName(node.variable)); | 1415 writeWord(getVariableName(node.variable)); |
| 1415 endLine('...;'); | 1416 endLine('...;'); |
| 1416 } | 1417 } |
| 1417 } | 1418 } |
| 1418 | 1419 |
| 1419 void writeVariableDeclaration(VariableDeclaration node, | 1420 void writeVariableDeclaration(VariableDeclaration node, |
| 1420 {bool useVarKeyword: false}) { | 1421 {bool useVarKeyword: false}) { |
| 1421 if (showOffsets) writeWord("[${node.fileOffset}]"); | 1422 if (showOffsets) writeWord("[${node.fileOffset}]"); |
| 1423 writeModifier(node.isCovariant, 'covariant'); |
| 1422 writeModifier(node.isFinal, 'final'); | 1424 writeModifier(node.isFinal, 'final'); |
| 1423 writeModifier(node.isConst, 'const'); | 1425 writeModifier(node.isConst, 'const'); |
| 1424 if (node.type != null) { | 1426 if (node.type != null) { |
| 1425 writeAnnotatedType(node.type, annotator?.annotateVariable(this, node)); | 1427 writeAnnotatedType(node.type, annotator?.annotateVariable(this, node)); |
| 1426 } | 1428 } |
| 1427 if (useVarKeyword && !node.isFinal && !node.isConst && node.type == null) { | 1429 if (useVarKeyword && !node.isFinal && !node.isConst && node.type == null) { |
| 1428 writeWord('var'); | 1430 writeWord('var'); |
| 1429 } | 1431 } |
| 1430 writeWord(getVariableName(node)); | 1432 writeWord(getVariableName(node)); |
| 1431 if (node.initializer != null) { | 1433 if (node.initializer != null) { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 } | 1672 } |
| 1671 throw 'illegal ProcedureKind: $kind'; | 1673 throw 'illegal ProcedureKind: $kind'; |
| 1672 } | 1674 } |
| 1673 | 1675 |
| 1674 class ExpressionPrinter { | 1676 class ExpressionPrinter { |
| 1675 final Printer writeer; | 1677 final Printer writeer; |
| 1676 final int minimumPrecedence; | 1678 final int minimumPrecedence; |
| 1677 | 1679 |
| 1678 ExpressionPrinter(this.writeer, this.minimumPrecedence); | 1680 ExpressionPrinter(this.writeer, this.minimumPrecedence); |
| 1679 } | 1681 } |
| OLD | NEW |