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

Unified Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 10633006: Process all resolver treeshaked elements in Dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/compiler.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/backend.dart
diff --git a/lib/compiler/implementation/dart_backend/backend.dart b/lib/compiler/implementation/dart_backend/backend.dart
index f547e2d6c6bb0f51086940e2a9524c0067a4d8db..45f0db10473e61a9ac9e52607baf8fade64fcd51 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -2,117 +2,34 @@
// 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.
-/**
- * Visitor to gather conservative estimate of functions which
- * can be invoked and classes which can be instantiated.
- */
-class ReachabilityVisitor implements Visitor {
- final Compiler compiler;
- final TreeElements elements;
-
- ResolverTask get resolver() => compiler.resolver;
- Enqueuer get world() => compiler.enqueuer.codegen;
-
- ReachabilityVisitor(this.compiler, this.elements);
-
- visitBlock(Block node) {}
- visitBreakStatement(BreakStatement node) {}
- visitCascade(Cascade node) {}
- visitCascadeReceiver(CascadeReceiver node) {}
- visitCaseMatch(CaseMatch node) {}
- visitCatchBlock(CatchBlock node) {}
- visitClassNode(ClassNode node) {
- internalError('should not reach ClassNode');
- }
- visitConditional(Conditional node) {}
- visitContinueStatement(ContinueStatement node) {}
- visitDoWhile(DoWhile node) {}
- visitEmptyStatement(EmptyStatement node) {}
- visitExpressionStatement(ExpressionStatement node) {}
- visitFor(For node) {}
- visitForIn(ForIn node) {}
- visitFunctionDeclaration(FunctionDeclaration node) {}
- visitFunctionExpression(FunctionExpression node) {
- // TODO(antonm): add a closure to working queue.
- unimplemented('FunctionExpression is not supported');
- }
- visitIdentifier(Identifier node) {}
- visitIf(If node) {}
- visitLabel(Label node) {}
- visitLabeledStatement(LabeledStatement node) {}
- visitLiteralBool(LiteralBool node) {}
- visitLiteralDouble(LiteralDouble node) {}
- visitLiteralInt(LiteralInt node) {}
- visitLiteralList(LiteralList node) {}
- visitLiteralMap(LiteralMap node) {}
- visitLiteralMapEntry(LiteralMapEntry node) {}
- visitLiteralNull(LiteralNull node) {}
- visitLiteralString(LiteralString node) {}
- visitModifiers(Modifiers node) {}
- visitNamedArgument(NamedArgument node) {}
- visitNodeList(NodeList node) {}
- visitOperator(Operator node) {}
- visitParenthesizedExpression(ParenthesizedExpression node) {}
- visitReturn(Return node) {}
- visitScriptTag(ScriptTag node) {}
- visitSend(Send node) {
- // TODO(antonm): update working queue.
- unimplemented('Send is not supported');
- }
- visitSendSet(SendSet node) {
- // TODO(antonm): update working queue.
- unimplemented('SendSet is not supported');
- }
- visitStringInterpolation(StringInterpolation node) {}
- visitStringInterpolationPart(StringInterpolationPart node) {}
- visitStringJuxtaposition(StringJuxtaposition node) {}
- visitSwitchCase(SwitchCase node) {}
- visitSwitchStatement(SwitchStatement node) {}
- visitThrow(Throw node) {}
- visitTryStatement(TryStatement node) {}
- visitTypeAnnotation(TypeAnnotation node) {}
- visitTypedef(Typedef node) {}
- visitTypeVariable(TypeVariable node) {}
- visitVariableDefinitions(VariableDefinitions node) {}
- visitWhile(While node) {}
-
- visitNewExpression(NewExpression node) {
- FunctionElement constructor = elements[node.send];
- resolver.resolveMethodElement(constructor);
- world.registerStaticUse(constructor.defaultImplementation);
- }
+class DartBackend extends Backend {
+ final List<CompilerTask> tasks;
+ final UnparseValidator unparseValidator;
- unimplemented(String reason) {
- throw new CompilerCancelledException('not implemented: $reason');
- }
+ Map<Element, TreeElements> get resolvedElements() =>
+ compiler.enqueuer.resolution.resolvedElements;
- internalError(String reason) {
- throw new CompilerCancelledException('internal error: $reason');
+ DartBackend(Compiler compiler, [bool validateUnparse = false])
+ : tasks = <CompilerTask>[],
+ unparseValidator = new UnparseValidator(compiler, validateUnparse),
+ super(compiler) {
+ tasks.add(unparseValidator);
}
-}
-
-class DartBackend extends Backend {
- final List<CompilerTask> tasks = const <CompilerTask>[];
-
- DartBackend(Compiler compiler) : super(compiler);
void enqueueHelpers(Enqueuer world) {
// TODO(antonm): Implement this method, if needed.
}
- String codegen(WorkItem work) {
- // Traverse AST to populate sets of reachable classes and functions.
- log('codegen(${work.element})');
- FunctionExpression function = work.element.parseNode(compiler);
- function.body.accept(new TraversingVisitor(
- new ReachabilityVisitor(compiler, work.resolutionTree)));
- }
+ String codegen(WorkItem work) { }
void processNativeClasses(Enqueuer world,
Collection<LibraryElement> libraries) {
}
void assembleProgram() {
+ resolvedElements.forEach((element, treeElements) {
+ unparseValidator.check(element);
+ });
compiler.assembledCode = '';
}
« no previous file with comments | « lib/compiler/implementation/compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698