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

Side by Side Diff: lib/compiler/implementation/resolver.dart

Issue 10905062: Fix issue 4361 by checking in the resolver if the getter/setter exists. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 interface TreeElements { 5 interface TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 DartType getType(TypeAnnotation annotation); 8 DartType getType(TypeAnnotation annotation);
9 } 9 }
10 10
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 } 1322 }
1323 } 1323 }
1324 } 1324 }
1325 1325
1326 visitSend(Send node) { 1326 visitSend(Send node) {
1327 Element target = resolveSend(node); 1327 Element target = resolveSend(node);
1328 if (!Element.isInvalid(target) 1328 if (!Element.isInvalid(target)
1329 && target.kind == ElementKind.ABSTRACT_FIELD) { 1329 && target.kind == ElementKind.ABSTRACT_FIELD) {
1330 AbstractFieldElement field = target; 1330 AbstractFieldElement field = target;
1331 target = field.getter; 1331 target = field.getter;
1332 if (Element.isInvalid(target) && !inInstanceContext) {
1333 error(node.selector, MessageKind.CANNOT_RESOLVE_GETTER);
kasperl 2012/09/04 05:50:07 This should definitely be coordinated with Karl, b
ngeoffray 2012/09/04 08:32:14 Done.
1334 }
1332 } 1335 }
1333 1336
1334 bool resolvedArguments = false; 1337 bool resolvedArguments = false;
1335 if (node.isOperator) { 1338 if (node.isOperator) {
1336 String operatorString = node.selector.asOperator().source.stringValue; 1339 String operatorString = node.selector.asOperator().source.stringValue;
1337 if (operatorString === 'is' || operatorString === 'as') { 1340 if (operatorString === 'is' || operatorString === 'as') {
1338 assert(node.arguments.tail.isEmpty()); 1341 assert(node.arguments.tail.isEmpty());
1339 resolveTypeTest(node.arguments.head); 1342 resolveTypeTest(node.arguments.head);
1340 resolvedArguments = true; 1343 resolvedArguments = true;
1341 } else if (operatorString === '?') { 1344 } else if (operatorString === '?') {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 } 1390 }
1388 1391
1389 visitSendSet(SendSet node) { 1392 visitSendSet(SendSet node) {
1390 Element target = resolveSend(node); 1393 Element target = resolveSend(node);
1391 Element setter = target; 1394 Element setter = target;
1392 Element getter = target; 1395 Element getter = target;
1393 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { 1396 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) {
1394 AbstractFieldElement field = target; 1397 AbstractFieldElement field = target;
1395 setter = field.setter; 1398 setter = field.setter;
1396 getter = field.getter; 1399 getter = field.getter;
1400 if (Element.isInvalid(setter) && !inInstanceContext) {
1401 error(node.selector, MessageKind.CANNOT_RESOLVE_SETTER);
1402 }
1397 } 1403 }
1398 1404
1399 visit(node.argumentsNode); 1405 visit(node.argumentsNode);
1400 1406
1401 // TODO(ngeoffray): Check if the target can be assigned. 1407 // TODO(ngeoffray): Check if the target can be assigned.
1402 // TODO(ngeoffray): Warn if target is null and the send is 1408 // TODO(ngeoffray): Warn if target is null and the send is
1403 // unqualified. 1409 // unqualified.
1404 1410
1405 Selector selector = mapping.getSelector(node); 1411 Selector selector = mapping.getSelector(node);
1406 String source = node.assignmentOperator.source.stringValue; 1412 String source = node.assignmentOperator.source.stringValue;
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 TopScope(LibraryElement library) : super(null, library); 2643 TopScope(LibraryElement library) : super(null, library);
2638 Element lookup(SourceString name) { 2644 Element lookup(SourceString name) {
2639 return library.find(name); 2645 return library.find(name);
2640 } 2646 }
2641 2647
2642 Element add(Element newElement) { 2648 Element add(Element newElement) {
2643 throw "Cannot add an element in the top scope"; 2649 throw "Cannot add an element in the top scope";
2644 } 2650 }
2645 String toString() => '$element'; 2651 String toString() => '$element';
2646 } 2652 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/warnings.dart » ('j') | lib/compiler/implementation/warnings.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698