979183decf
Fixes #27967 BUG= http://dartbug.com/27967 R=ahe@google.com, johnniwinther@google.com, paulberry@google.com, sigmund@google.com Committed: https://github.com/dart-lang/sdk/commit/85227ba8a60332a18ae92cb1b87bf15d52a909bd Reverted: https://github.com/dart-lang/sdk/commit/f5fc210f4f79f7e6b7ccefc24e7565e810e9dc7d Committed: https://github.com/dart-lang/sdk/commit/e4999a631093690febb2eb90cbdbe1f9d5183455 Reverted: https://github.com/dart-lang/sdk/commit/c64c35153905fc2bf8a74c02297220385cfcbc87 Committed: https://github.com/dart-lang/sdk/commit/c289af39c36d9a5f7130a3e69b7891052652a64e Reverted: https://github.com/dart-lang/sdk/commit/c66479f40767744d0bdd027c004583d6e32fe50f Review-Url: https://codereview.chromium.org/2567133002 .
53 lines
1.9 KiB
Dart
53 lines
1.9 KiB
Dart
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
library dart2js.parser.diet.task;
|
|
|
|
import '../common.dart';
|
|
import '../common/tasks.dart' show CompilerTask, Measurer;
|
|
import '../elements/elements.dart' show CompilationUnitElement;
|
|
import '../js_backend/backend.dart' show JavaScriptBackend;
|
|
import '../id_generator.dart';
|
|
import 'package:front_end/src/fasta/scanner.dart' show Token;
|
|
import 'element_listener.dart' show ElementListener, ScannerOptions;
|
|
import 'package:front_end/src/fasta/parser.dart'
|
|
show Listener, ParserError, TopLevelParser;
|
|
|
|
class PartialParser extends TopLevelParser {
|
|
PartialParser(Listener listener) : super(listener);
|
|
|
|
Token parseFormalParameters(Token token, {bool inFunctionType: false}) {
|
|
return skipFormalParameters(token);
|
|
}
|
|
}
|
|
|
|
class DietParserTask extends CompilerTask {
|
|
final IdGenerator _idGenerator;
|
|
final JavaScriptBackend _backend;
|
|
final DiagnosticReporter _reporter;
|
|
|
|
DietParserTask(
|
|
this._idGenerator, this._backend, this._reporter, Measurer measurer)
|
|
: super(measurer);
|
|
|
|
final String name = 'Diet Parser';
|
|
|
|
dietParse(CompilationUnitElement compilationUnit, Token tokens) {
|
|
measure(() {
|
|
ScannerOptions scannerOptions = new ScannerOptions(
|
|
canUseNative: _backend.canLibraryUseNative(compilationUnit.library));
|
|
ElementListener listener = new ElementListener(
|
|
scannerOptions, _reporter, compilationUnit, _idGenerator);
|
|
PartialParser parser = new PartialParser(listener);
|
|
try {
|
|
parser.parseUnit(tokens);
|
|
} on ParserError catch (_) {
|
|
// TODO(johnniwinther): assert that the error was reported once there is
|
|
// a [hasErrorBeenReported] field in [DiagnosticReporter]
|
|
// The error should have already been reported by the parser.
|
|
}
|
|
});
|
|
}
|
|
}
|