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

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

Issue 2680303002: Kernel debugging; service tests (Closed)
Patch Set: Address comments 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 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 /// A mutable AST node with a parent pointer. 88 /// A mutable AST node with a parent pointer.
89 /// 89 ///
90 /// This is anything other than [Name] and [DartType] nodes. 90 /// This is anything other than [Name] and [DartType] nodes.
91 abstract class TreeNode extends Node { 91 abstract class TreeNode extends Node {
92 static int _hashCounter = 0; 92 static int _hashCounter = 0;
93 final int hashCode = _hashCounter = (_hashCounter + 1) & 0x3fffffff; 93 final int hashCode = _hashCounter = (_hashCounter + 1) & 0x3fffffff;
94 static const int noOffset = -1; 94 static const int noOffset = -1;
95 95
96 TreeNode parent; 96 TreeNode parent;
97 97
98 /// Offset in the source file it comes from. Valid values are from 0 and up, 98 /// Offset in the source file it comes from.
99 /// or -1 ([noOffset]) if the file offset is not available 99 ///
100 /// (this is the default if none is specifically set). 100 /// Valid values are from 0 and up, or -1 ([noOffset]) if the file offset is
101 /// not available (this is the default if none is specifically set).
101 int fileOffset = noOffset; 102 int fileOffset = noOffset;
102 103
103 accept(TreeVisitor v); 104 accept(TreeVisitor v);
104 visitChildren(Visitor v); 105 visitChildren(Visitor v);
105 transformChildren(Transformer v); 106 transformChildren(Transformer v);
106 107
107 /// Replaces [child] with [replacement]. 108 /// Replaces [child] with [replacement].
108 /// 109 ///
109 /// The caller is responsible for ensuring that the AST remains a tree. In 110 /// The caller is responsible for ensuring that the AST remains a tree. In
110 /// particular, [replacement] should be an orphan or be part of an orphaned 111 /// particular, [replacement] should be an orphan or be part of an orphaned
(...skipping 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 3307
3307 /// Declaration of a local variable. 3308 /// Declaration of a local variable.
3308 /// 3309 ///
3309 /// This may occur as a statement, but is also used in several non-statement 3310 /// This may occur as a statement, but is also used in several non-statement
3310 /// contexts, such as in [ForStatement], [Catch], and [FunctionNode]. 3311 /// contexts, such as in [ForStatement], [Catch], and [FunctionNode].
3311 /// 3312 ///
3312 /// When this occurs as a statement, it must be a direct child of a [Block]. 3313 /// When this occurs as a statement, it must be a direct child of a [Block].
3313 // 3314 //
3314 // DESIGN TODO: Should we remove the 'final' modifier from variables? 3315 // DESIGN TODO: Should we remove the 'final' modifier from variables?
3315 class VariableDeclaration extends Statement { 3316 class VariableDeclaration extends Statement {
3317 /// Offset of the equals sign in the source file it comes from.
3318 ///
3319 /// Valid values are from 0 and up, or -1 ([TreeNode.noOffset])
3320 /// if the equals sign offset is not available (e.g. if not initialized)
3321 /// (this is the default if none is specifically set).
3322 int fileEqualsOffset = TreeNode.noOffset;
3323
3316 /// For named parameters, this is the name of the parameter. No two named 3324 /// For named parameters, this is the name of the parameter. No two named
3317 /// parameters (in the same parameter list) can have the same name. 3325 /// parameters (in the same parameter list) can have the same name.
3318 /// 3326 ///
3319 /// In all other cases, the name is cosmetic, may be empty or null, 3327 /// In all other cases, the name is cosmetic, may be empty or null,
3320 /// and is not necessarily unique. 3328 /// and is not necessarily unique.
3321 String name; 3329 String name;
3322 int flags = 0; 3330 int flags = 0;
3323 DartType type; // Not null, defaults to dynamic. 3331 DartType type; // Not null, defaults to dynamic.
3324 InferredValue inferredValue; // May be null. 3332 InferredValue inferredValue; // May be null.
3325 3333
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
4066 /// library has not been assigned a canonical name yet. 4074 /// library has not been assigned a canonical name yet.
4067 /// 4075 ///
4068 /// Returns `null` if the library is `null`. 4076 /// Returns `null` if the library is `null`.
4069 CanonicalName getCanonicalNameOfLibrary(Library library) { 4077 CanonicalName getCanonicalNameOfLibrary(Library library) {
4070 if (library == null) return null; 4078 if (library == null) return null;
4071 if (library.canonicalName == null) { 4079 if (library.canonicalName == null) {
4072 throw '$library has no canonical name'; 4080 throw '$library has no canonical name';
4073 } 4081 }
4074 return library.canonicalName; 4082 return library.canonicalName;
4075 } 4083 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/analyzer/ast_from_analyzer.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