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

Side by Side Diff: pkg/analyzer/lib/src/generated/element_resolver.dart

Issue 1177833002: Ensure that prefix?.loadLibrary() generates the proper compile-time error. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 engine.resolver.element_resolver; 5 library engine.resolver.element_resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'ast.dart'; 9 import 'ast.dart';
10 import 'element.dart'; 10 import 'element.dart';
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 } 584 }
585 Element staticElement; 585 Element staticElement;
586 Element propagatedElement; 586 Element propagatedElement;
587 DartType staticType = null; 587 DartType staticType = null;
588 DartType propagatedType = null; 588 DartType propagatedType = null;
589 if (target == null) { 589 if (target == null) {
590 staticElement = _resolveInvokedElement(methodName); 590 staticElement = _resolveInvokedElement(methodName);
591 propagatedElement = null; 591 propagatedElement = null;
592 } else if (methodName.name == FunctionElement.LOAD_LIBRARY_NAME && 592 } else if (methodName.name == FunctionElement.LOAD_LIBRARY_NAME &&
593 _isDeferredPrefix(target)) { 593 _isDeferredPrefix(target)) {
594 if (node.operator.type == sc.TokenType.QUESTION_PERIOD) {
595 _resolver.reportErrorForNode(
596 CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, target,
597 [(target as SimpleIdentifier).name]);
598 }
594 LibraryElement importedLibrary = _getImportedLibrary(target); 599 LibraryElement importedLibrary = _getImportedLibrary(target);
595 methodName.staticElement = importedLibrary.loadLibraryFunction; 600 methodName.staticElement = importedLibrary.loadLibraryFunction;
596 return null; 601 return null;
597 } else { 602 } else {
598 staticType = _getStaticType(target); 603 staticType = _getStaticType(target);
599 propagatedType = _getPropagatedType(target); 604 propagatedType = _getPropagatedType(target);
600 // 605 //
601 // If this method invocation is of the form 'C.m' where 'C' is a class, 606 // If this method invocation is of the form 'C.m' where 'C' is a class,
602 // then we don't call resolveInvokedElement(...) which walks up the class 607 // then we don't call resolveInvokedElement(...) which walks up the class
603 // hierarchy, instead we just look for the member in the type only. This 608 // hierarchy, instead we just look for the member in the type only. This
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 2811
2807 @override 2812 @override
2808 Element get staticElement => null; 2813 Element get staticElement => null;
2809 2814
2810 @override 2815 @override
2811 accept(AstVisitor visitor) => null; 2816 accept(AstVisitor visitor) => null;
2812 2817
2813 @override 2818 @override
2814 void visitChildren(AstVisitor visitor) {} 2819 void visitChildren(AstVisitor visitor) {}
2815 } 2820 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698