blob: 03a82220e3702d5e91394a6584d364d25a78b11b [file] [log] [blame]
// 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.
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;
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 {
} 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.