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

Side by Side Diff: tests/compiler/dart2js/private_test.dart

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Updated cf. comments Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind; 8 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
9 import 'package:compiler/src/io/source_file.dart'; 9 import 'package:compiler/src/io/source_file.dart';
10 import 'package:compiler/src/old_to_new_api.dart';
10 11
11 import 'mock_compiler.dart'; 12 import 'mock_compiler.dart';
12 13
13 const String PRIVATE_SOURCE_URI = 'src:private'; 14 const String PRIVATE_SOURCE_URI = 'src:private';
14 const String PRIVATE_SOURCE = ''' 15 const String PRIVATE_SOURCE = '''
15 16
16 var _privateVariable; 17 var _privateVariable;
17 void _privateFunction() {} 18 void _privateFunction() {}
18 19
19 class _PrivateClass { 20 class _PrivateClass {
(...skipping 21 matching lines...) Expand all
41 } 42 }
42 '''; 43 ''';
43 44
44 analyze(String text, [expectedWarnings]) { 45 analyze(String text, [expectedWarnings]) {
45 return () { 46 return () {
46 if (expectedWarnings == null) expectedWarnings = []; 47 if (expectedWarnings == null) expectedWarnings = [];
47 if (expectedWarnings is! List) expectedWarnings = [expectedWarnings]; 48 if (expectedWarnings is! List) expectedWarnings = [expectedWarnings];
48 49
49 MockCompiler compiler = new MockCompiler.internal(analyzeOnly: true); 50 MockCompiler compiler = new MockCompiler.internal(analyzeOnly: true);
50 compiler.registerSource(Uri.parse(PRIVATE_SOURCE_URI), PRIVATE_SOURCE); 51 compiler.registerSource(Uri.parse(PRIVATE_SOURCE_URI), PRIVATE_SOURCE);
51 compiler.diagnosticHandler = 52 compiler.diagnosticHandler = new LegacyCompilerDiagnostics(
52 (uri, int begin, int end, String message, kind) { 53 (uri, int begin, int end, String message, kind) {
53 SourceFile sourceFile = compiler.sourceFiles[uri.toString()]; 54 SourceFile sourceFile = compiler.sourceFiles[uri.toString()];
54 if (sourceFile != null) { 55 if (sourceFile != null) {
55 print(sourceFile.getLocationMessage(message, begin, end)); 56 print(sourceFile.getLocationMessage(message, begin, end));
56 } else { 57 } else {
57 print(message); 58 print(message);
58 } 59 }
59 }; 60 });
60 61
61 String source = ''' 62 String source = '''
62 library public; 63 library public;
63 64
64 import '$PRIVATE_SOURCE_URI'; 65 import '$PRIVATE_SOURCE_URI';
65 66
66 void main() { 67 void main() {
67 PublicClass publicClass; 68 PublicClass publicClass;
68 $text 69 $text
69 } 70 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Call public getter on public class. 161 // Call public getter on public class.
161 analyze('var value = publicClass.publicGetter;'), 162 analyze('var value = publicClass.publicGetter;'),
162 // Call public setter on public class. 163 // Call public setter on public class.
163 analyze('publicClass.publicSetter = 0;'), 164 analyze('publicClass.publicSetter = 0;'),
164 // Access public method on public class. 165 // Access public method on public class.
165 analyze('var value = publicClass.publicMethod;'), 166 analyze('var value = publicClass.publicMethod;'),
166 // Call public method on public class. 167 // Call public method on public class.
167 analyze('publicClass.publicMethod();'), 168 analyze('publicClass.publicMethod();'),
168 ], (f) => f())); 169 ], (f) => f()));
169 } 170 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/preserve_uris_test.dart ('k') | tests/compiler/dart2js/serialization/compilation_test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698