| 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 | 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 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3602 /// Given a source file uri and a offset in that file one can translate | 3602 /// Given a source file uri and a offset in that file one can translate |
| 3603 /// it to a line:column position in that file. | 3603 /// it to a line:column position in that file. |
| 3604 final Map<String, Source> uriToSource; | 3604 final Map<String, Source> uriToSource; |
| 3605 | 3605 |
| 3606 /// Reference to the main method in one of the libraries. | 3606 /// Reference to the main method in one of the libraries. |
| 3607 Procedure mainMethod; | 3607 Procedure mainMethod; |
| 3608 | 3608 |
| 3609 Program([List<Library> libraries, Map<String, Source> uriToSource]) | 3609 Program([List<Library> libraries, Map<String, Source> uriToSource]) |
| 3610 : libraries = libraries ?? <Library>[], | 3610 : libraries = libraries ?? <Library>[], |
| 3611 uriToSource = uriToSource ?? <String, Source>{} { | 3611 uriToSource = uriToSource ?? <String, Source>{} { |
| 3612 setParents(libraries, this); | 3612 setParents(this.libraries, this); |
| 3613 } | 3613 } |
| 3614 | 3614 |
| 3615 accept(TreeVisitor v) => v.visitProgram(this); | 3615 accept(TreeVisitor v) => v.visitProgram(this); |
| 3616 | 3616 |
| 3617 visitChildren(Visitor v) { | 3617 visitChildren(Visitor v) { |
| 3618 visitList(libraries, v); | 3618 visitList(libraries, v); |
| 3619 mainMethod?.acceptReference(v); | 3619 mainMethod?.acceptReference(v); |
| 3620 } | 3620 } |
| 3621 | 3621 |
| 3622 transformChildren(Transformer v) { | 3622 transformChildren(Transformer v) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3745 } | 3745 } |
| 3746 } | 3746 } |
| 3747 } | 3747 } |
| 3748 | 3748 |
| 3749 class Source { | 3749 class Source { |
| 3750 final List<int> lineStarts; | 3750 final List<int> lineStarts; |
| 3751 final String source; | 3751 final String source; |
| 3752 | 3752 |
| 3753 Source(this.lineStarts, this.source); | 3753 Source(this.lineStarts, this.source); |
| 3754 } | 3754 } |
| OLD | NEW |