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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1068243002: Overhaul tree IR visitor and rename IR classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library code_generator; 5 library code_generator;
6 6
7 import 'glue.dart'; 7 import 'glue.dart';
8 8
9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir;
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
11 import '../../elements/elements.dart'; 11 import '../../elements/elements.dart';
12 import '../../io/source_information.dart' show SourceInformation; 12 import '../../io/source_information.dart' show SourceInformation;
13 import '../../util/maplet.dart'; 13 import '../../util/maplet.dart';
14 import '../../constants/values.dart'; 14 import '../../constants/values.dart';
15 import '../../dart2jslib.dart'; 15 import '../../dart2jslib.dart';
16 16
17 class CodegenBailout { 17 class CodegenBailout {
18 final tree_ir.Node node; 18 final tree_ir.Node node;
19 final String reason; 19 final String reason;
20 CodegenBailout(this.node, this.reason); 20 CodegenBailout(this.node, this.reason);
21 String get message { 21 String get message {
22 return 'bailout${node != null ? " on $node" : ""}: $reason'; 22 return 'bailout${node != null ? " on $node" : ""}: $reason';
23 } 23 }
24 } 24 }
25 25
26 class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> { 26 class CodeGenerator extends tree_ir.StatementVisitor
27 with tree_ir.ExpressionVisitor<js.Expression> {
27 final CodegenRegistry registry; 28 final CodegenRegistry registry;
28 29
29 final Glue glue; 30 final Glue glue;
30 31
31 ExecutableElement currentFunction; 32 ExecutableElement currentFunction;
32 33
33 /// Maps variables to their name. 34 /// Maps variables to their name.
34 Map<tree_ir.Variable, String> variableNames = <tree_ir.Variable, String>{}; 35 Map<tree_ir.Variable, String> variableNames = <tree_ir.Variable, String>{};
35 36
36 /// Maps local constants to their name. 37 /// Maps local constants to their name.
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 @override 589 @override
589 visitFunctionExpression(tree_ir.FunctionExpression node) { 590 visitFunctionExpression(tree_ir.FunctionExpression node) {
590 return errorUnsupportedNode(node); 591 return errorUnsupportedNode(node);
591 } 592 }
592 593
593 @override 594 @override
594 visitFunctionDeclaration(tree_ir.FunctionDeclaration node) { 595 visitFunctionDeclaration(tree_ir.FunctionDeclaration node) {
595 return errorUnsupportedNode(node); 596 return errorUnsupportedNode(node);
596 } 597 }
597 598
598 @override
599 visitFieldInitializer(tree_ir.FieldInitializer node) {
600 return errorUnsupportedNode(node);
601 }
602
603 @override
604 visitSuperInitializer(tree_ir.SuperInitializer node) {
605 return errorUnsupportedNode(node);
606 }
607
608 errorUnsupportedNode(tree_ir.DartSpecificNode node) { 599 errorUnsupportedNode(tree_ir.DartSpecificNode node) {
609 throw "Unsupported node in JS backend: $node"; 600 throw "Unsupported node in JS backend: $node";
610 } 601 }
611 } 602 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698