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

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

Issue 184503002: Remove support for --force-strip=asserts from dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
index 8bd75a3d228adbf1e6929a9b07b9b19e25263baf..6f824f51c2828e5b5b460032654f0f376f7882e3 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
@@ -13,12 +13,6 @@ class ElementAst {
ElementAst(this.ast, this.treeElements);
- factory ElementAst.rewrite(compiler, ast, treeElements, stripAsserts) {
- final rewriter =
- new FunctionBodyRewriter(compiler, treeElements, stripAsserts);
- return new ElementAst(rewriter.visit(ast), rewriter.cloneTreeElements);
- }
-
ElementAst.forClassLike(this.ast)
: this.treeElements = new TreeElementMapping(null);
}
@@ -67,55 +61,6 @@ class VariableListAst extends ElementAst {
}
}
-class FunctionBodyRewriter extends CloningVisitor {
- final Compiler compiler;
- final bool stripAsserts;
-
- FunctionBodyRewriter(this.compiler, originalTreeElements, this.stripAsserts)
- : super(originalTreeElements);
-
- visitBlock(Block block) {
- shouldOmit(Statement statement) {
- if (statement is EmptyStatement) return true;
- ExpressionStatement expressionStatement =
- statement.asExpressionStatement();
- if (expressionStatement != null) {
- Send send = expressionStatement.expression.asSend();
- if (send != null) {
- Element element = originalTreeElements[send];
- if (stripAsserts && identical(element, compiler.assertMethod)) {
- return true;
- }
- }
- }
- return false;
- }
-
- rewriteStatement(Statement statement) {
- Block block = statement.asBlock();
- if (block != null) {
- Link statements = block.statements.nodes;
- if (!statements.isEmpty && statements.tail.isEmpty) {
- Statement single = statements.head;
- bool isDeclaration =
- single is VariableDefinitions || single is FunctionDeclaration;
- if (!isDeclaration) return single;
- }
- }
- return statement;
- }
-
- NodeList statements = block.statements;
- LinkBuilder<Statement> builder = new LinkBuilder<Statement>();
- for (Statement statement in statements.nodes) {
- if (!shouldOmit(statement)) {
- builder.addLast(visit(rewriteStatement(statement)));
- }
- }
- return new Block(rewriteNodeList(statements, builder.toLink()));
- }
-}
-
class DartBackend extends Backend {
final List<CompilerTask> tasks;
final bool forceStripTypes;
@@ -364,8 +309,7 @@ class DartBackend extends Backend {
});
resolvedElements.forEach((element, treeElements) {
if (!shouldOutput(element) || treeElements == null) return;
- var elementAst = new ElementAst.rewrite(
- compiler, parse(element), treeElements, stripAsserts);
+ var elementAst = new ElementAst(parse(element), treeElements);
if (element.isField()) {
final list = (element as VariableElement).variables;
elementAst = elementAsts.putIfAbsent(
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698