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

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

Issue 2962913002: Create an option to disable type inference and type promotion. (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) 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.source_library_builder; 5 library fasta.source_library_builder;
6 6
7 import 'package:front_end/src/scanner/token.dart' show Token; 7 import 'package:front_end/src/scanner/token.dart' show Token;
8 8
9 import 'package:kernel/ast.dart' show ProcedureKind; 9 import 'package:kernel/ast.dart' show ProcedureKind;
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 final List<SourceLibraryBuilder<T, R>> parts = <SourceLibraryBuilder<T, R>>[]; 51 final List<SourceLibraryBuilder<T, R>> parts = <SourceLibraryBuilder<T, R>>[];
52 52
53 final List<Import> imports = <Import>[]; 53 final List<Import> imports = <Import>[];
54 54
55 final Scope importScope; 55 final Scope importScope;
56 56
57 final Uri fileUri; 57 final Uri fileUri;
58 58
59 final List<List> implementationBuilders = <List<List>>[]; 59 final List<List> implementationBuilders = <List<List>>[];
60 60
61 /// Indicates whether type inference (and type promotion) should be disabled
62 /// for this library.
63 final bool disableTypeInference;
64
61 String name; 65 String name;
62 66
63 String partOfName; 67 String partOfName;
64 68
65 Uri partOfUri; 69 Uri partOfUri;
66 70
67 List<MetadataBuilder> metadata; 71 List<MetadataBuilder> metadata;
68 72
69 /// The current declaration that is being built. When we start parsing a 73 /// The current declaration that is being built. When we start parsing a
70 /// declaration (class, method, and so on), we don't have enough information 74 /// declaration (class, method, and so on), we don't have enough information
71 /// to create a builder and this object records its members and types until, 75 /// to create a builder and this object records its members and types until,
72 /// for example, [addClass] is called. 76 /// for example, [addClass] is called.
73 DeclarationBuilder<T> currentDeclaration; 77 DeclarationBuilder<T> currentDeclaration;
74 78
75 bool canAddImplementationBuilders = false; 79 bool canAddImplementationBuilders = false;
76 80
77 SourceLibraryBuilder(SourceLoader loader, Uri fileUri) 81 SourceLibraryBuilder(SourceLoader loader, Uri fileUri)
78 : this.fromScopes(loader, fileUri, new DeclarationBuilder<T>.library(), 82 : this.fromScopes(loader, fileUri, new DeclarationBuilder<T>.library(),
79 new Scope.top()); 83 new Scope.top());
80 84
81 SourceLibraryBuilder.fromScopes( 85 SourceLibraryBuilder.fromScopes(
82 this.loader, this.fileUri, this.libraryDeclaration, this.importScope) 86 this.loader, this.fileUri, this.libraryDeclaration, this.importScope)
83 : currentDeclaration = libraryDeclaration, 87 : disableTypeInference = loader.target.disableTypeInference,
88 currentDeclaration = libraryDeclaration,
84 super( 89 super(
85 fileUri, libraryDeclaration.toScope(importScope), new Scope.top()); 90 fileUri, libraryDeclaration.toScope(importScope), new Scope.top());
86 91
87 Uri get uri; 92 Uri get uri;
88 93
89 bool get isPart => partOfName != null || partOfUri != null; 94 bool get isPart => partOfName != null || partOfUri != null;
90 95
91 bool get isPatch; 96 bool get isPatch;
92 97
93 List<T> get types => libraryDeclaration.types; 98 List<T> get types => libraryDeclaration.types;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 /// synthesize type variables on the factory matching the class'. 604 /// synthesize type variables on the factory matching the class'.
600 void addFactoryDeclaration( 605 void addFactoryDeclaration(
601 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { 606 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) {
602 factoryDeclarations[procedure] = factoryDeclaration; 607 factoryDeclarations[procedure] = factoryDeclaration;
603 } 608 }
604 609
605 Scope toScope(Scope parent) { 610 Scope toScope(Scope parent) {
606 return new Scope(members, setters, parent, isModifiable: false); 611 return new Scope(members, setters, parent, isModifiable: false);
607 } 612 }
608 } 613 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/diet_listener.dart ('k') | pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698