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

Side by Side Diff: pkg/compiler/lib/src/parser/element_listener.dart

Issue 1864433004: Repeats and fixes the changes landed & reverted as CL 1789553003. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updates to external dependents Created 4 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.parser.element_listener; 5 library dart2js.parser.element_listener;
6 6
7 import '../compiler.dart' show
8 Compiler;
7 import '../common.dart'; 9 import '../common.dart';
8 import '../diagnostics/messages.dart' show 10 import '../diagnostics/messages.dart' show
9 MessageTemplate; 11 MessageTemplate;
10 import '../elements/elements.dart' show 12 import '../elements/elements.dart' show
11 Element, 13 Element,
12 LibraryElement, 14 LibraryElement,
13 MetadataAnnotation; 15 MetadataAnnotation;
14 import '../elements/modelx.dart' show 16 import '../elements/modelx.dart' show
15 CompilationUnitElementX, 17 CompilationUnitElementX,
16 DeclarationSite, 18 DeclarationSite,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 closeBraceFor, 52 closeBraceFor,
51 Listener, 53 Listener,
52 ParserError, 54 ParserError,
53 VERBOSE; 55 VERBOSE;
54 56
55 typedef int IdGenerator(); 57 typedef int IdGenerator();
56 58
57 /// Options used for scanning. 59 /// Options used for scanning.
58 /// 60 ///
59 /// Use this to conditionally support special tokens. 61 /// Use this to conditionally support special tokens.
62 ///
63 /// TODO(johnniwinther): This class should be renamed, it is not about options
64 /// in the same sense as `CompilerOptions` or `DiagnosticOptions`.
60 class ScannerOptions { 65 class ScannerOptions {
61 /// If `true` the pseudo keyword `native` is supported. 66 /// If `true` the pseudo keyword `native` is supported.
62 final bool canUseNative; 67 final bool canUseNative;
63 68
64 const ScannerOptions({this.canUseNative: false}); 69 const ScannerOptions({this.canUseNative: false});
70
71 ScannerOptions.from(Compiler compiler, LibraryElement libraryElement) :
72 canUseNative = compiler.backend.canLibraryUseNative(libraryElement);
65 } 73 }
66 74
67 /** 75 /**
68 * A parser event listener designed to work with [PartialParser]. It 76 * A parser event listener designed to work with [PartialParser]. It
69 * builds elements representing the top-level declarations found in 77 * builds elements representing the top-level declarations found in
70 * the parsed compilation unit and records them in 78 * the parsed compilation unit and records them in
71 * [compilationUnitElement]. 79 * [compilationUnitElement].
72 */ 80 */
73 class ElementListener extends Listener { 81 class ElementListener extends Listener {
74 final IdGenerator idGenerator; 82 final IdGenerator idGenerator;
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 MessageKind errorCode, 787 MessageKind errorCode,
780 [Map arguments = const {}]) { 788 [Map arguments = const {}]) {
781 if (currentMemberHasParseError) return; // Error already reported. 789 if (currentMemberHasParseError) return; // Error already reported.
782 if (suppressParseErrors) return; 790 if (suppressParseErrors) return;
783 if (!memberErrors.isEmpty) { 791 if (!memberErrors.isEmpty) {
784 memberErrors = memberErrors.tail.prepend(true); 792 memberErrors = memberErrors.tail.prepend(true);
785 } 793 }
786 reporter.reportErrorMessage(spannable, errorCode, arguments); 794 reporter.reportErrorMessage(spannable, errorCode, arguments);
787 } 795 }
788 } 796 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/diet_parser_task.dart ('k') | pkg/compiler/lib/src/parser/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698