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

Side by Side Diff: pkg/analyzer2dart/test/sexpr_test.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 /// Unittest test of the CPS ir generated by the analyzer2dart compiler. 5 /// Unittest test of the CPS ir generated by the analyzer2dart compiler.
6 6
7 import 'mock_sdk.dart'; 7 import 'mock_sdk.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 import 'package:analyzer/src/generated/sdk.dart'; 10 import 'package:analyzer/src/generated/sdk.dart';
(...skipping 24 matching lines...) Expand all
35 String rootFile = '/root.dart'; 35 String rootFile = '/root.dart';
36 provider.newFile(rootFile, input); 36 provider.newFile(rootFile, input);
37 Source rootSource = driver.setRoot(rootFile); 37 Source rootSource = driver.setRoot(rootFile);
38 FunctionElement entryPoint = driver.resolveEntryPoint(rootSource); 38 FunctionElement entryPoint = driver.resolveEntryPoint(rootSource);
39 ClosedWorld world = driver.computeWorld(entryPoint); 39 ClosedWorld world = driver.computeWorld(entryPoint);
40 ConvertedWorld convertedWorld = convertWorld(world); 40 ConvertedWorld convertedWorld = convertWorld(world);
41 41
42 void checkOutput(String elementName, 42 void checkOutput(String elementName,
43 dart2js.Element element, 43 dart2js.Element element,
44 String expectedOutput) { 44 String expectedOutput) {
45 ExecutableDefinition ir = convertedWorld.getIr(element); 45 RootNode ir = convertedWorld.getIr(element);
46 if (expectedOutput == null) { 46 if (expectedOutput == null) {
47 expect(ir, isNull, 47 expect(ir, isNull,
48 reason: "\nInput:\n${result.input}\n" 48 reason: "\nInput:\n${result.input}\n"
49 "No CPS IR expected for $element"); 49 "No CPS IR expected for $element");
50 } else { 50 } else {
51 expect(ir, isNotNull, 51 expect(ir, isNotNull,
52 reason: "\nInput:\n${result.input}\n" 52 reason: "\nInput:\n${result.input}\n"
53 "No CPS IR for $element"); 53 "No CPS IR for $element");
54 expectedOutput = expectedOutput.trim(); 54 expectedOutput = expectedOutput.trim();
55 String output = ir.accept(new SExpressionStringifier()); 55 String output = ir.accept(new SExpressionStringifier());
(...skipping 23 matching lines...) Expand all
79 found = true; 79 found = true;
80 } 80 }
81 names.add(name); 81 names.add(name);
82 } 82 }
83 }); 83 });
84 expect(found, isTrue, reason: "'$elementName' not found in $names."); 84 expect(found, isTrue, reason: "'$elementName' not found in $names.");
85 }); 85 });
86 } 86 }
87 } 87 }
88 88
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698