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

Side by Side Diff: lib/src/checker/checker.dart

Issue 1055923002: Don't call dinvoke on Object methods (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix for sealed types Created 5 years, 8 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dev_compiler.src.checker.checker; 5 library dev_compiler.src.checker.checker;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType;
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 node.expression = _checkReturn(node.expression, node); 559 node.expression = _checkReturn(node.expression, node);
560 node.visitChildren(this); 560 node.visitChildren(this);
561 } 561 }
562 562
563 visitReturnStatement(ReturnStatement node) { 563 visitReturnStatement(ReturnStatement node) {
564 node.expression = _checkReturn(node.expression, node); 564 node.expression = _checkReturn(node.expression, node);
565 node.visitChildren(this); 565 node.visitChildren(this);
566 } 566 }
567 567
568 visitPropertyAccess(PropertyAccess node) { 568 visitPropertyAccess(PropertyAccess node) {
569 if (_rules.isDynamicGet(node.realTarget)) { 569 if (node.staticType.isDynamic &&
570 _rules.isDynamicGet(node.realTarget, node.propertyName)) {
570 _recordDynamicInvoke(node); 571 _recordDynamicInvoke(node);
571 } 572 }
572 node.visitChildren(this); 573 node.visitChildren(this);
573 } 574 }
574 575
575 visitPrefixedIdentifier(PrefixedIdentifier node) { 576 visitPrefixedIdentifier(PrefixedIdentifier node) {
576 final target = node.prefix; 577 final target = node.prefix;
577 // Check if the prefix is a library - PrefixElement denotes a library 578 // Check if the prefix is a library - PrefixElement denotes a library
578 // access. 579 // access.
579 if (target.staticElement is! PrefixElement && _rules.isDynamicGet(target)) { 580 if (target.staticElement is! PrefixElement &&
581 _rules.isDynamicGet(target, node.identifier)) {
580 _recordDynamicInvoke(node); 582 _recordDynamicInvoke(node);
581 } 583 }
582 node.visitChildren(this); 584 node.visitChildren(this);
583 } 585 }
584 586
585 @override visitDefaultFormalParameter(DefaultFormalParameter node) { 587 @override visitDefaultFormalParameter(DefaultFormalParameter node) {
586 _visitMaybeConst(node, (node) { 588 _visitMaybeConst(node, (node) {
587 // Check that defaults have the proper subtype. 589 // Check that defaults have the proper subtype.
588 var parameter = node.parameter; 590 var parameter = node.parameter;
589 var parameterType = _rules.elementType(parameter.element); 591 var parameterType = _rules.elementType(parameter.element);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 void _recordDynamicInvoke(AstNode node) { 794 void _recordDynamicInvoke(AstNode node) {
793 _reporter.log(new DynamicInvoke(_rules, node)); 795 _reporter.log(new DynamicInvoke(_rules, node));
794 } 796 }
795 797
796 void _recordMessage(StaticInfo info) { 798 void _recordMessage(StaticInfo info) {
797 if (info == null) return; 799 if (info == null) return;
798 if (info.level >= logger.Level.SEVERE) _failure = true; 800 if (info.level >= logger.Level.SEVERE) _failure = true;
799 _reporter.log(info); 801 _reporter.log(info);
800 } 802 }
801 } 803 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698