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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/tree_tracer.dart

Issue 329983002: Implement references to "this" in the new IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 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 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 dart_backend.tracer; 5 library dart_backend.tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import '../tracer.dart'; 8 import '../tracer.dart';
9 import 'dart_tree.dart'; 9 import 'dart_tree.dart';
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 visitVariable(Variable node) {} 57 visitVariable(Variable node) {}
58 visitInvokeStatic(InvokeStatic node) {} 58 visitInvokeStatic(InvokeStatic node) {}
59 visitInvokeMethod(InvokeMethod node) {} 59 visitInvokeMethod(InvokeMethod node) {}
60 visitInvokeConstructor(InvokeConstructor node) {} 60 visitInvokeConstructor(InvokeConstructor node) {}
61 visitConcatenateStrings(ConcatenateStrings node) {} 61 visitConcatenateStrings(ConcatenateStrings node) {}
62 visitLiteralList(LiteralList node) {} 62 visitLiteralList(LiteralList node) {}
63 visitLiteralMap(LiteralMap node) {} 63 visitLiteralMap(LiteralMap node) {}
64 visitConstant(Constant node) {} 64 visitConstant(Constant node) {}
65 visitThis(This node) {}
65 visitConditional(Conditional node) {} 66 visitConditional(Conditional node) {}
66 visitLogicalOperator(LogicalOperator node) {} 67 visitLogicalOperator(LogicalOperator node) {}
67 visitNot(Not node) {} 68 visitNot(Not node) {}
68 69
69 visitLabeledStatement(LabeledStatement node) { 70 visitLabeledStatement(LabeledStatement node) {
70 Block target = new Block(node.label); 71 Block target = new Block(node.label);
71 breakTargets[node.label] = target; 72 breakTargets[node.label] = target;
72 visitStatement(node.body); 73 visitStatement(node.body);
73 _addBlock(target); 74 _addBlock(target);
74 visitStatement(node.next); 75 visitStatement(node.next);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 String value = visitExpression(node.values[i]); 333 String value = visitExpression(node.values[i]);
333 entries.add("$key: $value"); 334 entries.add("$key: $value");
334 } 335 }
335 return "map [${entries.join(', ')}]"; 336 return "map [${entries.join(', ')}]";
336 } 337 }
337 338
338 String visitConstant(Constant node) { 339 String visitConstant(Constant node) {
339 return "${node.value}"; 340 return "${node.value}";
340 } 341 }
341 342
343 String visitThis(This node) {
344 return "this";
345 }
346
342 bool usesInfixNotation(Expression node) { 347 bool usesInfixNotation(Expression node) {
343 return node is Conditional || node is LogicalOperator; 348 return node is Conditional || node is LogicalOperator;
344 } 349 }
345 350
346 String visitConditional(Conditional node) { 351 String visitConditional(Conditional node) {
347 String condition = visitExpression(node.condition); 352 String condition = visitExpression(node.condition);
348 String thenExpr = visitExpression(node.thenExpression); 353 String thenExpr = visitExpression(node.thenExpression);
349 String elseExpr = visitExpression(node.elseExpression); 354 String elseExpr = visitExpression(node.elseExpression);
350 return "$condition ? $thenExpr : $elseExpr"; 355 return "$condition ? $thenExpr : $elseExpr";
351 } 356 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 395 String prefix = v.element == null ? 'v' : '${v.element.name}_';
391 while (name == null || _usedNames.contains(name)) { 396 while (name == null || _usedNames.contains(name)) {
392 name = "$prefix${_counter++}"; 397 name = "$prefix${_counter++}";
393 } 398 }
394 _names[v] = name; 399 _names[v] = name;
395 _usedNames.add(name); 400 _usedNames.add(name);
396 } 401 }
397 return name; 402 return name;
398 } 403 }
399 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698