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

Side by Side Diff: tests/compiler/dart2js/inference/inference_test_helper.dart

Issue 2961313002: Always store GlobalTypeInferenceElementData on the member context (Closed)
Patch Set: Created 3 years, 5 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:compiler/src/common.dart'; 5 import 'package:compiler/src/common.dart';
6 import 'package:compiler/src/compiler.dart'; 6 import 'package:compiler/src/compiler.dart';
7 import 'package:compiler/src/elements/elements.dart'; 7 import 'package:compiler/src/elements/elements.dart';
8 import 'package:compiler/src/elements/entities.dart'; 8 import 'package:compiler/src/elements/entities.dart';
9 import 'package:compiler/src/tree/nodes.dart'; 9 import 'package:compiler/src/tree/nodes.dart';
10 import 'package:compiler/src/types/types.dart'; 10 import 'package:compiler/src/types/types.dart';
(...skipping 22 matching lines...) Expand all
33 final GlobalTypeInferenceResults results; 33 final GlobalTypeInferenceResults results;
34 final GlobalTypeInferenceElementResult result; 34 final GlobalTypeInferenceElementResult result;
35 35
36 TypeMaskComputer(DiagnosticReporter reporter, Map<Id, String> actualMap, 36 TypeMaskComputer(DiagnosticReporter reporter, Map<Id, String> actualMap,
37 Map<Id, Spannable> spannableMap, ResolvedAst resolvedAst, this.results) 37 Map<Id, Spannable> spannableMap, ResolvedAst resolvedAst, this.results)
38 : result = results.resultOfMember(resolvedAst.element as MemberElement), 38 : result = results.resultOfMember(resolvedAst.element as MemberElement),
39 super(reporter, actualMap, spannableMap, resolvedAst); 39 super(reporter, actualMap, spannableMap, resolvedAst);
40 40
41 @override 41 @override
42 String computeElementValue(AstElement element) { 42 String computeElementValue(AstElement element) {
43 GlobalTypeInferenceElementResult elementResult = 43 GlobalTypeInferenceElementResult elementResult;
44 results.resultOfElement(element); 44 if (element.isParameter) {
45 elementResult = results.resultOfParameter(element);
46 } else if (element.isLocal) {
47 LocalFunctionElement localFunction = element;
48 elementResult = results.resultOfMember(localFunction.memberContext);
Siggi Cherem (dart-lang) 2017/06/29 21:40:09 memberContext or callMethod?
Johnni Winther 2017/06/30 08:14:50 They amount to the same but like using .callMethod
49 } else {
50 elementResult = results.resultOfMember(element);
51 }
52
45 TypeMask value = 53 TypeMask value =
46 element.isFunction ? elementResult.returnType : elementResult.type; 54 element.isFunction ? elementResult.returnType : elementResult.type;
47 return value != null ? '$value' : null; 55 return value != null ? '$value' : null;
48 } 56 }
49 57
50 @override 58 @override
51 String computeNodeValue(Node node, [AstElement element]) { 59 String computeNodeValue(Node node, [AstElement element]) {
52 if (node is Send) { 60 if (node is Send) {
53 TypeMask value = result.typeOfSend(node); 61 TypeMask value = result.typeOfSend(node);
54 return value != null ? '$value' : null; 62 return value != null ? '$value' : null;
55 } else if (element != null && element.isLocal) { 63 } else if (element != null && element.isLocal) {
56 return computeElementValue(element); 64 return computeElementValue(element);
57 } 65 }
58 return null; 66 return null;
59 } 67 }
60 } 68 }
OLDNEW
« pkg/compiler/lib/src/inferrer/inferrer_engine.dart ('K') | « pkg/compiler/lib/src/types/types.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698