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

Unified Diff: lib/src/codegen/reify_coercions.dart

Issue 1166163002: remove unused allowConstCast option (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: format Created 5 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/src/checker/rules.dart ('k') | lib/src/options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen/reify_coercions.dart
diff --git a/lib/src/codegen/reify_coercions.dart b/lib/src/codegen/reify_coercions.dart
index 0ce42849f24b20e5df7363b95f6c3c6a65696247..5e5a7c520539f1b394bfbd9ca02fc68a535c6bf1 100644
--- a/lib/src/codegen/reify_coercions.dart
+++ b/lib/src/codegen/reify_coercions.dart
@@ -12,7 +12,6 @@ import 'package:logging/logging.dart' as logger;
import 'package:dev_compiler/devc.dart' show AbstractCompiler;
import 'package:dev_compiler/src/checker/rules.dart';
import 'package:dev_compiler/src/info.dart';
-import 'package:dev_compiler/src/options.dart' show CompilerOptions;
import 'ast_builder.dart';
@@ -97,20 +96,17 @@ class CoercionReifier extends analyzer.GeneralizingAstVisitor<Object>
final TypeManager _tm;
final VariableManager _vm;
final LibraryUnit _library;
- bool _skipCoercions = false;
final _Inference _inferrer;
- final CompilerOptions _options;
- CoercionReifier._(this._cm, this._tm, this._vm, this._library, this._inferrer,
- this._options);
+ CoercionReifier._(
+ this._cm, this._tm, this._vm, this._library, this._inferrer);
factory CoercionReifier(LibraryUnit library, AbstractCompiler compiler) {
var vm = new VariableManager();
var tm = new TypeManager(library.library.element.enclosingElement, vm);
var cm = new CoercionManager(vm, tm);
var inferrer = new _Inference(compiler.rules, tm);
- var options = compiler.options;
- return new CoercionReifier._(cm, tm, vm, library, inferrer, options);
+ return new CoercionReifier._(cm, tm, vm, library, inferrer);
}
// This should be the entry point for this class. Entering via the
@@ -142,10 +138,6 @@ class CoercionReifier extends analyzer.GeneralizingAstVisitor<Object>
@override
Object visitDownCast(DownCast node) {
- if (_skipCoercions && !_options.allowConstCasts) {
- _log.severe("Skipping runtime downcast in constant context");
- return null;
- }
Expression castNode = _cm.coerceExpression(node.node, node.cast);
if (!NodeReplacer.replace(node, castNode)) {
_log.severe("Failed to replace node for DownCast");
@@ -157,10 +149,6 @@ class CoercionReifier extends analyzer.GeneralizingAstVisitor<Object>
// TODO(leafp): Bind the coercions at the top level
@override
Object visitClosureWrapBase(ClosureWrapBase node) {
- if (_skipCoercions && !_options.allowConstCasts) {
- _log.severe("Skipping coercion wrap in constant context");
- return null;
- }
Expression newE = _cm.coerceExpression(node.node, node.wrapper);
if (!NodeReplacer.replace(node, newE)) {
_log.severe("Failed to replace node for Closure Wrap");
@@ -169,27 +157,6 @@ class CoercionReifier extends analyzer.GeneralizingAstVisitor<Object>
return null;
}
- @override
- Object visitNode(AstNode n) {
- var o = _skipCoercions;
- if (!o) {
- if (n is VariableDeclarationList) {
- _skipCoercions = o || n.isConst;
- } else if (n is VariableDeclaration) {
- _skipCoercions = o || n.isConst;
- } else if (n is FormalParameter) {
- _skipCoercions = o || n.isConst;
- } else if (n is InstanceCreationExpression) {
- _skipCoercions = o || n.isConst;
- } else if (n is ConstructorDeclaration) {
- _skipCoercions = o || n.element.isConst;
- }
- }
- Object ret = super.visitNode(n);
- _skipCoercions = o;
- return ret;
- }
-
Object visitCompilationUnit(CompilationUnit unit) {
_cm.enterCompilationUnit(unit);
Object ret = super.visitCompilationUnit(unit);
« no previous file with comments | « lib/src/checker/rules.dart ('k') | lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698