Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: pkg/kernel/lib/text/ast_to_text.dart

Issue 2767773004: Add Vector type to Kernel (Closed)
Patch Set: Make fixes suggested by the reviewers Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 writeWord(node.length.toString());
1028 writeSymbol(')');
1029 }
1030
1031 visitVectorGet(VectorGet node) {
1032 writeExpression(node.vectorExpression);
1033 writeSymbol('[');
1034 writeWord(node.index.toString());
1035 writeSymbol(']');
1036 }
1037
1038 visitVectorSet(VectorSet node) {
1039 writeExpression(node.vectorExpression);
1040 writeSymbol('[');
1041 writeWord(node.index.toString());
1042 writeSymbol(']');
1043 writeSpaced('=');
1044 writeExpression(node.value);
1045 }
1046
1047 visitVectorCopy(VectorCopy node) {
1048 writeWord('CopyVector');
1049 writeSymbol('(');
1050 writeExpression(node.vectorExpression);
1051 writeSymbol(')');
1052 }
1053
1020 visitDeferredImport(DeferredImport node) { 1054 visitDeferredImport(DeferredImport node) {
1021 write('import "'); 1055 write('import "');
1022 write('${node.importedLibrary.importUri}'); 1056 write('${node.importedLibrary.importUri}');
1023 write('" deferred as '); 1057 write('" deferred as ');
1024 write(node.name); 1058 write(node.name);
1025 endLine(';'); 1059 endLine(';');
1026 } 1060 }
1027 1061
1028 defaultExpression(Expression node) { 1062 defaultExpression(Expression node) {
1029 writeWord('${node.runtimeType}'); 1063 writeWord('${node.runtimeType}');
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 } 1630 }
1597 throw 'illegal ProcedureKind: $kind'; 1631 throw 'illegal ProcedureKind: $kind';
1598 } 1632 }
1599 1633
1600 class ExpressionPrinter { 1634 class ExpressionPrinter {
1601 final Printer writeer; 1635 final Printer writeer;
1602 final int minimumPrecedence; 1636 final int minimumPrecedence;
1603 1637
1604 ExpressionPrinter(this.writeer, this.minimumPrecedence); 1638 ExpressionPrinter(this.writeer, this.minimumPrecedence);
1605 } 1639 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698