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 import '../type_propagation/type_propagation.dart'; | 8 import '../type_propagation/type_propagation.dart'; |
9 | 9 |
10 class Namer<T> { | 10 class Namer<T> { |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 } else { | 448 } else { |
449 writeClassReference(type.classNode); | 449 writeClassReference(type.classNode); |
450 if (type.typeArguments.isNotEmpty) { | 450 if (type.typeArguments.isNotEmpty) { |
451 writeSymbol('<'); | 451 writeSymbol('<'); |
452 writeList(type.typeArguments, writeType); | 452 writeList(type.typeArguments, writeType); |
453 writeSymbol('>'); | 453 writeSymbol('>'); |
454 } | 454 } |
455 } | 455 } |
456 } | 456 } |
457 | 457 |
458 visitVectorType(VectorType type) { | |
459 writeWord('Vector'); | |
460 } | |
461 | |
458 void writeModifier(bool isThere, String name) { | 462 void writeModifier(bool isThere, String name) { |
459 if (isThere) { | 463 if (isThere) { |
460 writeWord(name); | 464 writeWord(name); |
461 } | 465 } |
462 } | 466 } |
463 | 467 |
464 void writeName(Name name) { | 468 void writeName(Name name) { |
465 if (name?.name == '') { | 469 if (name?.name == '') { |
466 writeWord(emptyNameString); | 470 writeWord(emptyNameString); |
467 } else { | 471 } else { |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 } | 1014 } |
1011 | 1015 |
1012 visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) { | 1016 visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) { |
1013 writeWord('CheckLibraryIsLoaded'); | 1017 writeWord('CheckLibraryIsLoaded'); |
1014 writeSymbol('('); | 1018 writeSymbol('('); |
1015 writeWord(node.import.name); | 1019 writeWord(node.import.name); |
1016 writeSymbol(')'); | 1020 writeSymbol(')'); |
1017 state = WORD; | 1021 state = WORD; |
1018 } | 1022 } |
1019 | 1023 |
1024 visitVectorCreation(VectorCreation node) { | |
1025 writeWord('MakeVector'); | |
1026 writeSymbol('('); | |
1027 writeExpression(node.length); | |
1028 writeSymbol(')'); | |
1029 } | |
1030 | |
1031 visitVectorGet(VectorGet node) { | |
1032 writeExpression(node.vectorExpression); | |
1033 writeSymbol('['); | |
1034 writeExpression(node.index); | |
1035 writeSymbol(']'); | |
1036 } | |
1037 | |
1038 visitVectorSet(VectorSet node) { | |
1039 writeExpression(node.vectorExpression); | |
1040 writeSymbol('['); | |
1041 writeExpression(node.index); | |
1042 writeSymbol(']'); | |
1043 state = WORD; | |
1044 writeWord('='); | |
asgerf
2017/03/22 14:33:22
Please change to writeSpaced('=')
Dmitry Stefantsov
2017/03/23 11:22:43
Thanks! Done.
| |
1045 writeExpression(node.value); | |
1046 } | |
1047 | |
1048 visitVectorCopy(VectorCopy node) { | |
1049 writeWord('CopyVector'); | |
1050 writeSymbol('('); | |
1051 writeExpression(node.vectorExpression); | |
1052 writeSymbol(')'); | |
1053 } | |
1054 | |
1020 visitDeferredImport(DeferredImport node) { | 1055 visitDeferredImport(DeferredImport node) { |
1021 write('import "'); | 1056 write('import "'); |
1022 write('${node.importedLibrary.importUri}'); | 1057 write('${node.importedLibrary.importUri}'); |
1023 write('" deferred as '); | 1058 write('" deferred as '); |
1024 write(node.name); | 1059 write(node.name); |
1025 endLine(';'); | 1060 endLine(';'); |
1026 } | 1061 } |
1027 | 1062 |
1028 defaultExpression(Expression node) { | 1063 defaultExpression(Expression node) { |
1029 writeWord('${node.runtimeType}'); | 1064 writeWord('${node.runtimeType}'); |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1596 } | 1631 } |
1597 throw 'illegal ProcedureKind: $kind'; | 1632 throw 'illegal ProcedureKind: $kind'; |
1598 } | 1633 } |
1599 | 1634 |
1600 class ExpressionPrinter { | 1635 class ExpressionPrinter { |
1601 final Printer writeer; | 1636 final Printer writeer; |
1602 final int minimumPrecedence; | 1637 final int minimumPrecedence; |
1603 | 1638 |
1604 ExpressionPrinter(this.writeer, this.minimumPrecedence); | 1639 ExpressionPrinter(this.writeer, this.minimumPrecedence); |
1605 } | 1640 } |
OLD | NEW |