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

Side by Side Diff: pkg/kernel/lib/ast.dart

Issue 2986093002: Revert two Kernel changes that were causing test failures. (Closed)
Patch Set: Revert "Migrate language/async_backwards... ... language/async_star_take..." Created 3 years, 4 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 4
5 /// ----------------------------------------------------------------------- 5 /// -----------------------------------------------------------------------
6 /// ERROR HANDLING 6 /// ERROR HANDLING
7 /// ----------------------------------------------------------------------- 7 /// -----------------------------------------------------------------------
8 /// 8 ///
9 /// As a rule of thumb, errors that can be detected statically are handled by 9 /// As a rule of thumb, errors that can be detected statically are handled by
10 /// the frontend, typically by translating the erroneous code into a 'throw' or 10 /// the frontend, typically by translating the erroneous code into a 'throw' or
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 transformChildren(Transformer v) {} 486 transformChildren(Transformer v) {}
487 } 487 }
488 488
489 /// Declaration of a type alias. 489 /// Declaration of a type alias.
490 class Typedef extends NamedNode { 490 class Typedef extends NamedNode {
491 /// The uri of the source file that contains the declaration of this typedef. 491 /// The uri of the source file that contains the declaration of this typedef.
492 String fileUri; 492 String fileUri;
493 List<Expression> annotations = const <Expression>[]; 493 List<Expression> annotations = const <Expression>[];
494 String name; 494 String name;
495 final List<TypeParameter> typeParameters; 495 final List<TypeParameter> typeParameters;
496
497 @informative
498 int requiredParameterCount = 0;
499
500 @informative
501 List<VariableDeclaration> positionalParameters = <VariableDeclaration>[];
502
503 @informative
504 List<VariableDeclaration> namedParameters = <VariableDeclaration>[];
505
506 DartType type; 496 DartType type;
507 497
508 Typedef(this.name, this.type, 498 Typedef(this.name, this.type,
509 {Reference reference, this.fileUri, List<TypeParameter> typeParameters}) 499 {Reference reference, this.fileUri, List<TypeParameter> typeParameters})
510 : this.typeParameters = typeParameters ?? <TypeParameter>[], 500 : this.typeParameters = typeParameters ?? <TypeParameter>[],
511 super(reference) { 501 super(reference) {
512 setParents(this.typeParameters, this); 502 setParents(this.typeParameters, this);
513 } 503 }
514 504
515 Library get enclosingLibrary => parent; 505 Library get enclosingLibrary => parent;
516 506
517 accept(TreeVisitor v) { 507 accept(TreeVisitor v) {
518 return v.visitTypedef(this); 508 return v.visitTypedef(this);
519 } 509 }
520 510
521 void setParameters(
522 int requiredParameterCount,
523 List<VariableDeclaration> positionalParameters,
524 List<VariableDeclaration> namedParameters) {
525 this.requiredParameterCount = requiredParameterCount;
526 this.positionalParameters = positionalParameters;
527 this.namedParameters = namedParameters;
528 setParents(this.positionalParameters, this);
529 setParents(this.namedParameters, this);
530 }
531
532 transformChildren(Transformer v) { 511 transformChildren(Transformer v) {
533 transformList(annotations, v, this); 512 transformList(annotations, v, this);
534 transformList(typeParameters, v, this); 513 transformList(typeParameters, v, this);
535 transformList(positionalParameters, v, this);
536 transformList(namedParameters, v, this);
537 if (type != null) { 514 if (type != null) {
538 type = v.visitDartType(type); 515 type = v.visitDartType(type);
539 } 516 }
540 } 517 }
541 518
542 visitChildren(Visitor v) { 519 visitChildren(Visitor v) {
543 visitList(annotations, v); 520 visitList(annotations, v);
544 visitList(typeParameters, v); 521 visitList(typeParameters, v);
545 visitList(typeParameters, v);
546 visitList(positionalParameters, v);
547 visitList(namedParameters, v);
548 type?.accept(v); 522 type?.accept(v);
549 } 523 }
550 524
551 void addAnnotation(Expression node) { 525 void addAnnotation(Expression node) {
552 if (annotations.isEmpty) { 526 if (annotations.isEmpty) {
553 annotations = <Expression>[]; 527 annotations = <Expression>[];
554 } 528 }
555 annotations.add(node); 529 annotations.add(node);
556 node.parent = this; 530 node.parent = this;
557 } 531 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // ------------------------------------------------------------------------ 827 // ------------------------------------------------------------------------
854 // MEMBERS 828 // MEMBERS
855 // ------------------------------------------------------------------------ 829 // ------------------------------------------------------------------------
856 830
857 abstract class Member extends NamedNode { 831 abstract class Member extends NamedNode {
858 /// End offset in the source file it comes from. Valid values are from 0 and 832 /// End offset in the source file it comes from. Valid values are from 0 and
859 /// up, or -1 ([TreeNode.noOffset]) if the file end offset is not available 833 /// up, or -1 ([TreeNode.noOffset]) if the file end offset is not available
860 /// (this is the default if none is specifically set). 834 /// (this is the default if none is specifically set).
861 int fileEndOffset = TreeNode.noOffset; 835 int fileEndOffset = TreeNode.noOffset;
862 836
863 /// Documentation comment of the member, or `null`.
864 @informative
865 String documentationComment;
866
867 /// List of metadata annotations on the member. 837 /// List of metadata annotations on the member.
868 /// 838 ///
869 /// This defaults to an immutable empty list. Use [addAnnotation] to add 839 /// This defaults to an immutable empty list. Use [addAnnotation] to add
870 /// annotations if needed. 840 /// annotations if needed.
871 List<Expression> annotations = const <Expression>[]; 841 List<Expression> annotations = const <Expression>[];
872 Name name; 842 Name name;
873 843
874 /// Flags summarizing the kinds of AST nodes contained in this member, for 844 /// Flags summarizing the kinds of AST nodes contained in this member, for
875 /// speeding up transformations that only affect certain types of nodes. 845 /// speeding up transformations that only affect certain types of nodes.
876 /// 846 ///
(...skipping 3829 matching lines...) Expand 10 before | Expand all | Expand 10 after
4706 if (typedef_.canonicalName == null) { 4676 if (typedef_.canonicalName == null) {
4707 throw '$typedef_ has no canonical name'; 4677 throw '$typedef_ has no canonical name';
4708 } 4678 }
4709 return typedef_.canonicalName; 4679 return typedef_.canonicalName;
4710 } 4680 }
4711 4681
4712 /// Annotation describing information which is not part of Dart semantics; in 4682 /// Annotation describing information which is not part of Dart semantics; in
4713 /// other words, if this information (or any information it refers to) changes, 4683 /// other words, if this information (or any information it refers to) changes,
4714 /// static analysis and runtime behavior of the library are unaffected. 4684 /// static analysis and runtime behavior of the library are unaffected.
4715 const informative = null; 4685 const informative = null;
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/source_library_builder.dart ('k') | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698