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

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

Issue 958603002: Added VariableUse expression to tree IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated docs regarding catch parameters Created 5 years, 9 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;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return new js.This(); 337 return new js.This();
338 } 338 }
339 339
340 @override 340 @override
341 js.Expression visitTypeOperator(tree_ir.TypeOperator node) { 341 js.Expression visitTypeOperator(tree_ir.TypeOperator node) {
342 return giveup(node); 342 return giveup(node);
343 // TODO: implement visitTypeOperator 343 // TODO: implement visitTypeOperator
344 } 344 }
345 345
346 @override 346 @override
347 js.Expression visitVariable(tree_ir.Variable node) { 347 js.Expression visitVariableUse(tree_ir.VariableUse node) {
348 return new js.VariableUse(getVariableName(node)); 348 return buildVariableAccess(node.variable);
349 }
350
351 js.Expression buildVariableAccess(tree_ir.Variable variable) {
352 return new js.VariableUse(getVariableName(variable));
349 } 353 }
350 354
351 @override 355 @override
352 void visitContinue(tree_ir.Continue node) { 356 void visitContinue(tree_ir.Continue node) {
353 tree_ir.Statement fallthrough = this.fallthrough; 357 tree_ir.Statement fallthrough = this.fallthrough;
354 if (node.target.binding == fallthrough) { 358 if (node.target.binding == fallthrough) {
355 // Fall through to continue target 359 // Fall through to continue target
356 } else if (fallthrough is tree_ir.Continue && 360 } else if (fallthrough is tree_ir.Continue &&
357 fallthrough.target == node.target) { 361 fallthrough.target == node.target) {
358 // Fall through to equivalent continue 362 // Fall through to equivalent continue
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 fallthrough = savedFallthrough; 400 fallthrough = savedFallthrough;
397 return result; 401 return result;
398 } 402 }
399 403
400 @override 404 @override
401 void visitAssign(tree_ir.Assign node) { 405 void visitAssign(tree_ir.Assign node) {
402 tree_ir.Expression value = node.definition; 406 tree_ir.Expression value = node.definition;
403 js.Expression definition = visitExpression(value); 407 js.Expression definition = visitExpression(value);
404 408
405 accumulator.add(new js.ExpressionStatement(new js.Assignment( 409 accumulator.add(new js.ExpressionStatement(new js.Assignment(
406 visitVariable(node.variable), 410 buildVariableAccess(node.variable),
407 definition))); 411 definition)));
408 visitStatement(node.next); 412 visitStatement(node.next);
409 } 413 }
410 414
411 @override 415 @override
412 void visitBreak(tree_ir.Break node) { 416 void visitBreak(tree_ir.Break node) {
413 tree_ir.Statement fallthrough = this.fallthrough; 417 tree_ir.Statement fallthrough = this.fallthrough;
414 if (node.target.binding.next == fallthrough) { 418 if (node.target.binding.next == fallthrough) {
415 // Fall through to break target 419 // Fall through to break target
416 } else if (fallthrough is tree_ir.Break && 420 } else if (fallthrough is tree_ir.Break &&
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 532
529 @override 533 @override
530 visitSuperInitializer(tree_ir.SuperInitializer node) { 534 visitSuperInitializer(tree_ir.SuperInitializer node) {
531 return errorUnsupportedNode(node); 535 return errorUnsupportedNode(node);
532 } 536 }
533 537
534 dynamic errorUnsupportedNode(tree_ir.DartSpecificNode node) { 538 dynamic errorUnsupportedNode(tree_ir.DartSpecificNode node) {
535 throw "Unsupported node in JS backend: $node"; 539 throw "Unsupported node in JS backend: $node";
536 } 540 }
537 } 541 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698