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

Side by Side Diff: pkg/front_end/lib/src/fasta/source/diet_listener.dart

Issue 2830313002: Split up TypeInferrer class. (Closed)
Patch Set: Created 3 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.diet_listener; 5 library fasta.diet_listener;
6 6
7 import 'package:front_end/src/fasta/kernel/kernel_ast_factory.dart' 7 import 'package:front_end/src/fasta/kernel/kernel_ast_factory.dart'
8 show KernelAstFactory; 8 show KernelAstFactory;
9 9
10 import 'package:front_end/src/fasta/type_inference/type_inferrer.dart' 10 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart'
11 show TypeInferrer; 11 show TypeInferenceEngine;
12 12
13 import 'package:kernel/ast.dart' show AsyncMarker; 13 import 'package:kernel/ast.dart' show AsyncMarker;
14 14
15 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; 15 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
16 16
17 import 'package:kernel/core_types.dart' show CoreTypes; 17 import 'package:kernel/core_types.dart' show CoreTypes;
18 18
19 import '../fasta_codes.dart' show FastaMessage, codeExpectedBlockToSkip; 19 import '../fasta_codes.dart' show FastaMessage, codeExpectedBlockToSkip;
20 20
21 import '../parser/parser.dart' show Parser, optional; 21 import '../parser/parser.dart' show Parser, optional;
(...skipping 17 matching lines...) Expand all
39 39
40 class DietListener extends StackListener { 40 class DietListener extends StackListener {
41 final SourceLibraryBuilder library; 41 final SourceLibraryBuilder library;
42 42
43 final ClassHierarchy hierarchy; 43 final ClassHierarchy hierarchy;
44 44
45 final CoreTypes coreTypes; 45 final CoreTypes coreTypes;
46 46
47 final bool isDartLibrary; 47 final bool isDartLibrary;
48 48
49 final TypeInferrer localTypeInferrer; 49 final TypeInferenceEngine typeInferenceEngine;
50 50
51 ClassBuilder currentClass; 51 ClassBuilder currentClass;
52 52
53 /// For top-level declarations, this is the library scope. For class members, 53 /// For top-level declarations, this is the library scope. For class members,
54 /// this is the instance scope of [currentClass]. 54 /// this is the instance scope of [currentClass].
55 Scope memberScope; 55 Scope memberScope;
56 56
57 @override 57 @override
58 Uri uri; 58 Uri uri;
59 59
60 DietListener(SourceLibraryBuilder library, this.hierarchy, this.coreTypes, 60 DietListener(SourceLibraryBuilder library, this.hierarchy, this.coreTypes,
61 this.localTypeInferrer) 61 this.typeInferenceEngine)
62 : library = library, 62 : library = library,
63 uri = library.fileUri, 63 uri = library.fileUri,
64 memberScope = library.scope, 64 memberScope = library.scope,
65 isDartLibrary = library.uri.scheme == "dart"; 65 isDartLibrary = library.uri.scheme == "dart";
66 66
67 void discard(int n) { 67 void discard(int n) {
68 for (int i = 0; i < n; i++) { 68 for (int i = 0; i < n; i++) {
69 pop(); 69 pop();
70 } 70 }
71 } 71 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return new BodyBuilder( 396 return new BodyBuilder(
397 library, 397 library,
398 builder, 398 builder,
399 memberScope, 399 memberScope,
400 formalParameterScope, 400 formalParameterScope,
401 hierarchy, 401 hierarchy,
402 coreTypes, 402 coreTypes,
403 currentClass, 403 currentClass,
404 isInstanceMember, 404 isInstanceMember,
405 uri, 405 uri,
406 localTypeInferrer, 406 typeInferenceEngine.createLocalTypeInferrer(uri),
407 new KernelAstFactory()) 407 new KernelAstFactory())
408 ..constantExpressionRequired = builder.isConstructor && builder.isConst; 408 ..constantExpressionRequired = builder.isConstructor && builder.isConst;
409 } 409 }
410 410
411 void buildFunctionBody(Token token, ProcedureBuilder builder) { 411 void buildFunctionBody(Token token, ProcedureBuilder builder) {
412 Scope typeParameterScope = builder.computeTypeParameterScope(memberScope); 412 Scope typeParameterScope = builder.computeTypeParameterScope(memberScope);
413 Scope formalParameterScope = 413 Scope formalParameterScope =
414 builder.computeFormalParameterScope(typeParameterScope); 414 builder.computeFormalParameterScope(typeParameterScope);
415 assert(typeParameterScope != null); 415 assert(typeParameterScope != null);
416 assert(formalParameterScope != null); 416 assert(formalParameterScope != null);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 bool get isTargetingDartVm { 571 bool get isTargetingDartVm {
572 // TODO(ahe): Find a more reliable way to check if this is the Dart VM. 572 // TODO(ahe): Find a more reliable way to check if this is the Dart VM.
573 return !coreTypes.containsLibrary("dart:_js_helper"); 573 return !coreTypes.containsLibrary("dart:_js_helper");
574 } 574 }
575 575
576 @override 576 @override
577 void debugEvent(String name) { 577 void debugEvent(String name) {
578 // printEvent(name); 578 // printEvent(name);
579 } 579 }
580 } 580 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | pkg/front_end/lib/src/fasta/source/source_class_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698