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

Side by Side Diff: pkg/compiler/lib/src/inferrer/builder.dart

Issue 2653203002: Use entities in CommonElements interface. (Closed)
Patch Set: Created 3 years, 11 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 simple_types_inferrer; 5 library simple_types_inferrer;
6 6
7 import '../closure.dart' show ClosureClassMap; 7 import '../closure.dart' show ClosureClassMap;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show Identifiers, Selectors; 9 import '../common/names.dart' show Identifiers, Selectors;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
11 import '../constants/constant_system.dart'; 11 import '../constants/constant_system.dart';
12 import '../constants/expressions.dart'; 12 import '../constants/expressions.dart';
13 import '../constants/values.dart' show ConstantValue, IntConstantValue; 13 import '../constants/values.dart' show ConstantValue, IntConstantValue;
14 import '../elements/resolution_types.dart' show ResolutionDartType; 14 import '../elements/resolution_types.dart'
15 show ResolutionDartType, ResolutionInterfaceType;
15 import '../elements/elements.dart'; 16 import '../elements/elements.dart';
16 import '../js_backend/backend_helpers.dart'; 17 import '../js_backend/backend_helpers.dart';
17 import '../js_backend/js_backend.dart' as js; 18 import '../js_backend/js_backend.dart' as js;
18 import '../native/native.dart' as native; 19 import '../native/native.dart' as native;
19 import '../resolution/operators.dart' as op; 20 import '../resolution/operators.dart' as op;
20 import '../resolution/semantic_visitor.dart'; 21 import '../resolution/semantic_visitor.dart';
21 import '../resolution/tree_elements.dart' show TreeElements; 22 import '../resolution/tree_elements.dart' show TreeElements;
22 import '../tree/tree.dart' as ast; 23 import '../tree/tree.dart' as ast;
23 import '../types/constants.dart' show computeTypeMask; 24 import '../types/constants.dart' show computeTypeMask;
24 import '../types/types.dart' show TypeMask, GlobalTypeInferenceElementData; 25 import '../types/types.dart' show TypeMask, GlobalTypeInferenceElementData;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 (operator == '!=' && !usePositive)) { 397 (operator == '!=' && !usePositive)) {
397 // Type the elements as null. 398 // Type the elements as null.
398 if (Elements.isLocal(receiverElement)) { 399 if (Elements.isLocal(receiverElement)) {
399 locals.update(receiverElement, types.nullType, node); 400 locals.update(receiverElement, types.nullType, node);
400 } 401 }
401 if (Elements.isLocal(argumentElement)) { 402 if (Elements.isLocal(argumentElement)) {
402 locals.update(argumentElement, types.nullType, node); 403 locals.update(argumentElement, types.nullType, node);
403 } 404 }
404 } else { 405 } else {
405 // Narrow the elements to a non-null type. 406 // Narrow the elements to a non-null type.
406 ResolutionDartType objectType = closedWorld.commonElements.objectType; 407 ResolutionInterfaceType objectType =
408 closedWorld.commonElements.objectType;
407 if (Elements.isLocal(receiverElement)) { 409 if (Elements.isLocal(receiverElement)) {
408 narrow(receiverElement, objectType, node); 410 narrow(receiverElement, objectType, node);
409 } 411 }
410 if (Elements.isLocal(argumentElement)) { 412 if (Elements.isLocal(argumentElement)) {
411 narrow(argumentElement, objectType, node); 413 narrow(argumentElement, objectType, node);
412 } 414 }
413 } 415 }
414 } 416 }
415 } 417 }
416 } 418 }
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 return handleSuperNoSuchMethod(node, selector, mask, arguments); 2026 return handleSuperNoSuchMethod(node, selector, mask, arguments);
2025 } 2027 }
2026 2028
2027 TypeInformation handleSuperNoSuchMethod(ast.Send node, Selector selector, 2029 TypeInformation handleSuperNoSuchMethod(ast.Send node, Selector selector,
2028 TypeMask mask, ArgumentsTypes arguments) { 2030 TypeMask mask, ArgumentsTypes arguments) {
2029 // Ensure we create a node, to make explicit the call to the 2031 // Ensure we create a node, to make explicit the call to the
2030 // `noSuchMethod` handler. 2032 // `noSuchMethod` handler.
2031 ClassElement cls = outermostElement.enclosingClass; 2033 ClassElement cls = outermostElement.enclosingClass;
2032 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); 2034 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_);
2033 if (!Selectors.noSuchMethod_.signatureApplies(element)) { 2035 if (!Selectors.noSuchMethod_.signatureApplies(element)) {
2034 element = compiler.commonElements.objectClass 2036 ClassElement objectClass = compiler.commonElements.objectClass;
2035 .lookupMember(Identifiers.noSuchMethod_); 2037 element = objectClass.lookupMember(Identifiers.noSuchMethod_);
2036 } 2038 }
2037 return handleStaticSend(node, selector, mask, element, arguments); 2039 return handleStaticSend(node, selector, mask, element, arguments);
2038 } 2040 }
2039 2041
2040 /// Handle a .call invocation on the values retrieved from the super 2042 /// Handle a .call invocation on the values retrieved from the super
2041 /// [element]. For instance `super.foo(bar)` where `foo` is a field or getter. 2043 /// [element]. For instance `super.foo(bar)` where `foo` is a field or getter.
2042 TypeInformation handleSuperClosureCall( 2044 TypeInformation handleSuperClosureCall(
2043 ast.Send node, Element element, ast.NodeList arguments) { 2045 ast.Send node, Element element, ast.NodeList arguments) {
2044 ArgumentsTypes argumentTypes = analyzeArguments(arguments.nodes); 2046 ArgumentsTypes argumentTypes = analyzeArguments(arguments.nodes);
2045 Selector selector = elements.getSelector(node); 2047 Selector selector = elements.getSelector(node);
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
2930 Selector moveNextSelector = Selectors.moveNext; 2932 Selector moveNextSelector = Selectors.moveNext;
2931 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); 2933 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node);
2932 2934
2933 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, 2935 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector,
2934 iteratorMask, expressionType, new ArgumentsTypes.empty()); 2936 iteratorMask, expressionType, new ArgumentsTypes.empty());
2935 2937
2936 return handleForInLoop(node, iteratorType, currentSelector, currentMask, 2938 return handleForInLoop(node, iteratorType, currentSelector, currentMask,
2937 moveNextSelector, moveNextMask); 2939 moveNextSelector, moveNextMask);
2938 } 2940 }
2939 } 2941 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/resolution_types.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698