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 library fasta.verifier; | 5 library fasta.verifier; |
6 | 6 |
7 import 'package:front_end/src/fasta/type_inference/type_schema.dart' | 7 import 'package:front_end/src/fasta/type_inference/type_schema.dart' |
8 show TypeSchemaVisitor, UnknownType; | 8 show TypeSchemaVisitor, UnknownType; |
9 | 9 |
10 import 'package:kernel/ast.dart' | 10 import 'package:kernel/ast.dart' |
(...skipping 29 matching lines...) Expand all Loading... | |
40 String fileUri; | 40 String fileUri; |
41 | 41 |
42 FastaVerifyingVisitor(bool isOutline) { | 42 FastaVerifyingVisitor(bool isOutline) { |
43 this.isOutline = isOutline; | 43 this.isOutline = isOutline; |
44 } | 44 } |
45 | 45 |
46 @override | 46 @override |
47 problem(TreeNode node, String details, {TreeNode context}) { | 47 problem(TreeNode node, String details, {TreeNode context}) { |
48 context ??= this.context; | 48 context ??= this.context; |
49 VerificationError error = new VerificationError(context, node, details); | 49 VerificationError error = new VerificationError(context, node, details); |
50 printUnexpected(Uri.parse(fileUri), node?.fileOffset ?? -1, "$error"); | 50 var uri = fileUri != null ? Uri.parse(fileUri) : null; |
ahe
2017/05/22 11:49:04
Why is fileUri null?
Siggi Cherem (dart-lang)
2017/05/22 23:15:48
I ran into this when hitting verification errors f
ahe
2017/05/24 15:45:47
My preference would be to revert this so we can fi
| |
51 var offset = (uri != null && node != null) ? node.fileOffset : -1; | |
52 printUnexpected(uri, offset, "$error"); | |
51 errors.add(error); | 53 errors.add(error); |
52 } | 54 } |
53 | 55 |
54 @override | 56 @override |
55 visitExpressionStatement(ExpressionStatement node) { | 57 visitExpressionStatement(ExpressionStatement node) { |
56 // Bypass verification of the [StaticGet] in [RedirectingFactoryBody] as | 58 // Bypass verification of the [StaticGet] in [RedirectingFactoryBody] as |
57 // this is a static get without a getter. | 59 // this is a static get without a getter. |
58 if (node is! RedirectingFactoryBody) { | 60 if (node is! RedirectingFactoryBody) { |
59 super.visitExpressionStatement(node); | 61 super.visitExpressionStatement(node); |
60 } | 62 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 visitInvalidInitializer(InvalidInitializer node) { | 100 visitInvalidInitializer(InvalidInitializer node) { |
99 problem(node, "Invalid initializer."); | 101 problem(node, "Invalid initializer."); |
100 } | 102 } |
101 | 103 |
102 @override | 104 @override |
103 visitUnknownType(UnknownType node) { | 105 visitUnknownType(UnknownType node) { |
104 // Note: we can't pass [node] to [problem] because it's not a [TreeNode]. | 106 // Note: we can't pass [node] to [problem] because it's not a [TreeNode]. |
105 problem(null, "Unexpected appearance of the unknown type."); | 107 problem(null, "Unexpected appearance of the unknown type."); |
106 } | 108 } |
107 } | 109 } |
OLD | NEW |