mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 14:32:24 +00:00
Avoid dart:io dependency in try
BUG= Review URL: https://codereview.chromium.org//1336843003.
This commit is contained in:
parent
bda5146f40
commit
f850f312e3
5 changed files with 32 additions and 34 deletions
|
@ -7,8 +7,6 @@ library compiler_helper;
|
|||
import 'dart:async';
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
import 'package:compiler/compiler.dart' as api;
|
||||
|
||||
import 'package:compiler/src/elements/elements.dart'
|
||||
as lego;
|
||||
export 'package:compiler/src/elements/elements.dart';
|
||||
|
@ -40,7 +38,7 @@ export 'package:compiler/src/tree/tree.dart';
|
|||
import 'mock_compiler.dart';
|
||||
export 'mock_compiler.dart';
|
||||
|
||||
import 'memory_compiler.dart';
|
||||
import 'memory_compiler.dart' hide compilerFor;
|
||||
|
||||
import 'output_collector.dart';
|
||||
export 'output_collector.dart';
|
||||
|
@ -132,34 +130,6 @@ Future<String> compile(String code,
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(herhut): Disallow warnings and errors during compilation by default.
|
||||
MockCompiler compilerFor(String code, Uri uri,
|
||||
{bool analyzeAll: false,
|
||||
bool analyzeOnly: false,
|
||||
Map<String, String> coreSource,
|
||||
bool disableInlining: true,
|
||||
bool minify: false,
|
||||
bool trustTypeAnnotations: false,
|
||||
bool enableTypeAssertions: false,
|
||||
int expectedErrors,
|
||||
int expectedWarnings,
|
||||
api.CompilerOutputProvider outputProvider}) {
|
||||
MockCompiler compiler = new MockCompiler.internal(
|
||||
analyzeAll: analyzeAll,
|
||||
analyzeOnly: analyzeOnly,
|
||||
coreSource: coreSource,
|
||||
disableInlining: disableInlining,
|
||||
enableMinification: minify,
|
||||
trustTypeAnnotations: trustTypeAnnotations,
|
||||
enableTypeAssertions: enableTypeAssertions,
|
||||
expectedErrors: expectedErrors,
|
||||
expectedWarnings: expectedWarnings,
|
||||
outputProvider: outputProvider);
|
||||
compiler.registerSource(uri, code);
|
||||
compiler.diagnosticHandler = createHandler(compiler, code);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
Future<String> compileAll(String code,
|
||||
{Map<String, String> coreSource,
|
||||
bool disableInlining: true,
|
||||
|
|
|
@ -437,3 +437,31 @@ class MockElement extends FunctionElementX {
|
|||
|
||||
bool get hasNode => false;
|
||||
}
|
||||
|
||||
// TODO(herhut): Disallow warnings and errors during compilation by default.
|
||||
MockCompiler compilerFor(String code, Uri uri,
|
||||
{bool analyzeAll: false,
|
||||
bool analyzeOnly: false,
|
||||
Map<String, String> coreSource,
|
||||
bool disableInlining: true,
|
||||
bool minify: false,
|
||||
bool trustTypeAnnotations: false,
|
||||
bool enableTypeAssertions: false,
|
||||
int expectedErrors,
|
||||
int expectedWarnings,
|
||||
api.CompilerOutputProvider outputProvider}) {
|
||||
MockCompiler compiler = new MockCompiler.internal(
|
||||
analyzeAll: analyzeAll,
|
||||
analyzeOnly: analyzeOnly,
|
||||
coreSource: coreSource,
|
||||
disableInlining: disableInlining,
|
||||
enableMinification: minify,
|
||||
trustTypeAnnotations: trustTypeAnnotations,
|
||||
enableTypeAssertions: enableTypeAssertions,
|
||||
expectedErrors: expectedErrors,
|
||||
expectedWarnings: expectedWarnings,
|
||||
outputProvider: outputProvider);
|
||||
compiler.registerSource(uri, code);
|
||||
compiler.diagnosticHandler = createHandler(compiler, code);
|
||||
return compiler;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ export 'dart:async' show
|
|||
import 'package:async_helper/async_helper.dart' show
|
||||
asyncTest;
|
||||
|
||||
import '../../compiler/dart2js/compiler_helper.dart' show
|
||||
import '../../compiler/dart2js/mock_compiler.dart' show
|
||||
MockCompiler,
|
||||
compilerFor;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import 'package:dart2js_incremental/diff.dart' show
|
|||
Difference,
|
||||
computeDifference;
|
||||
|
||||
import '../../compiler/dart2js/compiler_helper.dart' show
|
||||
import '../../compiler/dart2js/mock_compiler.dart' show
|
||||
MockCompiler,
|
||||
compilerFor;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Remove this file when dart2js support such features.
|
||||
library trydart.forget_element_assertion;
|
||||
|
||||
import '../../compiler/dart2js/compiler_helper.dart' show
|
||||
import '../../compiler/dart2js/mock_compiler.dart' show
|
||||
compilerFor;
|
||||
|
||||
import 'compiler_test_case.dart';
|
||||
|
|
Loading…
Reference in a new issue