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

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

Issue 2895983002: Read SDK and patches from a JSON file. (Closed)
Patch Set: Merged with 1333f97b9a0e3805f991578ef83b0ec4553ecf33 Created 3 years, 7 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/type_inference/type_inference_engine.dart' 7 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart'
8 show TypeInferenceEngine; 8 show TypeInferenceEngine;
9 9
10 import 'package:front_end/src/fasta/type_inference/type_inference_listener.dart' 10 import 'package:front_end/src/fasta/type_inference/type_inference_listener.dart'
(...skipping 27 matching lines...) Expand all
38 38
39 import 'source_library_builder.dart' show SourceLibraryBuilder; 39 import 'source_library_builder.dart' show SourceLibraryBuilder;
40 40
41 class DietListener extends StackListener { 41 class DietListener extends StackListener {
42 final SourceLibraryBuilder library; 42 final SourceLibraryBuilder library;
43 43
44 final ClassHierarchy hierarchy; 44 final ClassHierarchy hierarchy;
45 45
46 final CoreTypes coreTypes; 46 final CoreTypes coreTypes;
47 47
48 final bool isDartLibrary; 48 final bool enableNative;
49 49
50 final TypeInferenceEngine typeInferenceEngine; 50 final TypeInferenceEngine typeInferenceEngine;
51 51
52 ClassBuilder currentClass; 52 ClassBuilder currentClass;
53 53
54 /// For top-level declarations, this is the library scope. For class members, 54 /// For top-level declarations, this is the library scope. For class members,
55 /// this is the instance scope of [currentClass]. 55 /// this is the instance scope of [currentClass].
56 Scope memberScope; 56 Scope memberScope;
57 57
58 @override 58 @override
59 Uri uri; 59 Uri uri;
60 60
61 DietListener(SourceLibraryBuilder library, this.hierarchy, this.coreTypes, 61 DietListener(SourceLibraryBuilder library, this.hierarchy, this.coreTypes,
62 this.typeInferenceEngine) 62 this.typeInferenceEngine)
63 : library = library, 63 : library = library,
64 uri = library.fileUri, 64 uri = library.fileUri,
65 memberScope = library.scope, 65 memberScope = library.scope,
66 isDartLibrary = library.uri.scheme == "dart"; 66 enableNative = (library.uri.scheme == "dart" || library.isPatch);
67 67
68 void discard(int n) { 68 void discard(int n) {
69 for (int i = 0; i < n; i++) { 69 for (int i = 0; i < n; i++) {
70 pop(); 70 pop();
71 } 71 }
72 } 72 }
73 73
74 @override 74 @override
75 void endMetadataStar(int count, bool forParameter) { 75 void endMetadataStar(int count, bool forParameter) {
76 debugEvent("MetadataStar"); 76 debugEvent("MetadataStar");
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 @override 480 @override
481 void endNamedMixinApplication(Token beginToken, Token classKeyword, 481 void endNamedMixinApplication(Token beginToken, Token classKeyword,
482 Token equals, Token implementsKeyword, Token endToken) { 482 Token equals, Token implementsKeyword, Token endToken) {
483 debugEvent("NamedMixinApplication"); 483 debugEvent("NamedMixinApplication");
484 pop(); // Name. 484 pop(); // Name.
485 checkEmpty(beginToken.charOffset); 485 checkEmpty(beginToken.charOffset);
486 } 486 }
487 487
488 @override 488 @override
489 Token handleUnrecoverableError(Token token, FastaMessage message) { 489 Token handleUnrecoverableError(Token token, FastaMessage message) {
490 if (isDartLibrary && message.code == codeExpectedBlockToSkip) { 490 if (enableNative && message.code == codeExpectedBlockToSkip) {
491 Token recover = library.loader.target.skipNativeClause(token); 491 Token recover = library.loader.target.skipNativeClause(token);
492 if (recover != null) return recover; 492 if (recover != null) return recover;
493 } 493 }
494 return super.handleUnrecoverableError(token, message); 494 return super.handleUnrecoverableError(token, message);
495 } 495 }
496 496
497 @override 497 @override
498 Link<Token> handleMemberName(Link<Token> identifiers) { 498 Link<Token> handleMemberName(Link<Token> identifiers) {
499 if (!isDartLibrary || identifiers.isEmpty) return identifiers; 499 if (!enableNative || identifiers.isEmpty) return identifiers;
500 return removeNativeClause(identifiers); 500 return removeNativeClause(identifiers);
501 } 501 }
502 502
503 AsyncMarker getAsyncMarker(StackListener listener) => listener.pop(); 503 AsyncMarker getAsyncMarker(StackListener listener) => listener.pop();
504 504
505 void parseFunctionBody(StackListener listener, Token token, MemberKind kind) { 505 void parseFunctionBody(StackListener listener, Token token, MemberKind kind) {
506 try { 506 try {
507 Parser parser = new Parser(listener); 507 Parser parser = new Parser(listener);
508 token = parser.parseFormalParametersOpt(token, kind); 508 token = parser.parseFormalParametersOpt(token, kind);
509 var formals = listener.pop(); 509 var formals = listener.pop();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 fileUri: message.uri, 577 fileUri: message.uri,
578 // We assume this error has already been reported by OutlineBuilder. 578 // We assume this error has already been reported by OutlineBuilder.
579 silent: true); 579 silent: true);
580 } 580 }
581 581
582 @override 582 @override
583 void debugEvent(String name) { 583 void debugEvent(String name) {
584 // printEvent(name); 584 // printEvent(name);
585 } 585 }
586 } 586 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/loader.dart ('k') | pkg/front_end/lib/src/fasta/source/outline_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698