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 library kernel.checks; | 4 library kernel.checks; |
5 | 5 |
6 import 'ast.dart'; | 6 import 'ast.dart'; |
7 import 'transformations/flags.dart'; | 7 import 'transformations/flags.dart'; |
8 | 8 |
9 void verifyProgram(Program program) { | 9 void verifyProgram(Program program) { |
10 VerifyingVisitor.check(program); | 10 VerifyingVisitor.check(program); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 checkVariableInScope(node.variable, node); | 356 checkVariableInScope(node.variable, node); |
357 visitChildren(node); | 357 visitChildren(node); |
358 } | 358 } |
359 | 359 |
360 @override | 360 @override |
361 visitStaticGet(StaticGet node) { | 361 visitStaticGet(StaticGet node) { |
362 visitChildren(node); | 362 visitChildren(node); |
363 if (node.target == null) { | 363 if (node.target == null) { |
364 problem(node, "StaticGet without target."); | 364 problem(node, "StaticGet without target."); |
365 } | 365 } |
366 if (!node.target.hasGetter) { | 366 // Currently Constructor.hasGetter returns `false` even though fasta uses it |
367 // as a getter for internal purposes: | |
368 // | |
369 // Fasta is letting all call site of a redirecting constructor be resolved | |
370 // to the real target. In order to resolve it, it seems to add a body into | |
371 // the redirecting-factory constructor which caches the target constructor. | |
372 // That cache is via a `StaticGet(real-constructor)` node, which we make | |
373 // here pass the verifier. | |
374 if (!node.target.hasGetter && node.target is! Constructor) { | |
ahe
2017/08/21 13:48:33
Can you show provide me with an example of how thi
kustermann
2017/08/21 14:43:44
Followed Peter's recommendation offline and commen
| |
367 problem(node, "StaticGet of '${node.target}' without getter."); | 375 problem(node, "StaticGet of '${node.target}' without getter."); |
368 } | 376 } |
369 if (node.target.isInstanceMember) { | 377 if (node.target.isInstanceMember) { |
370 problem(node, "StaticGet of '${node.target}' that's an instance member."); | 378 problem(node, "StaticGet of '${node.target}' that's an instance member."); |
371 } | 379 } |
372 } | 380 } |
373 | 381 |
374 @override | 382 @override |
375 visitStaticSet(StaticSet node) { | 383 visitStaticSet(StaticSet node) { |
376 visitChildren(node); | 384 visitChildren(node); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 var oldParent = parent; | 609 var oldParent = parent; |
602 parent = node; | 610 parent = node; |
603 node.visitChildren(this); | 611 node.visitChildren(this); |
604 parent = oldParent; | 612 parent = oldParent; |
605 } | 613 } |
606 } | 614 } |
607 | 615 |
608 void checkInitializers(Constructor constructor) { | 616 void checkInitializers(Constructor constructor) { |
609 // TODO(ahe): I'll add more here in other CLs. | 617 // TODO(ahe): I'll add more here in other CLs. |
610 } | 618 } |
OLD | NEW |