| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'memory_compiler.dart'; | 7 import 'memory_compiler.dart'; |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:compiler/src/commandline_options.dart'; | 9 import 'package:compiler/src/commandline_options.dart'; |
| 10 import 'package:compiler/src/common_elements.dart'; | 10 import 'package:compiler/src/common_elements.dart'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 Uri entryPoint = Uri.parse('memory:main.dill'); | 43 Uri entryPoint = Uri.parse('memory:main.dill'); |
| 44 | 44 |
| 45 String buildDir = Platform.isMacOS ? 'xcodebuild' : 'out'; | 45 String buildDir = Platform.isMacOS ? 'xcodebuild' : 'out'; |
| 46 String configuration = | 46 String configuration = |
| 47 Platform.environment['DART_CONFIGURATION'] ?? 'ReleaseX64'; | 47 Platform.environment['DART_CONFIGURATION'] ?? 'ReleaseX64'; |
| 48 String sdkPath = '$buildDir/$configuration/patched_dart2js_sdk/'; | 48 String sdkPath = '$buildDir/$configuration/patched_dart2js_sdk/'; |
| 49 var platform = Uri.base.resolve('$sdkPath/platform.dill'); | 49 var platform = Uri.base.resolve('$sdkPath/platform.dill'); |
| 50 var options = new CompilerOptions() | 50 var options = new CompilerOptions() |
| 51 ..target = new Dart2jsTarget(new TargetFlags()) | 51 ..target = new Dart2jsTarget(new TargetFlags()) |
| 52 ..packagesFileUri = Uri.base.resolve('.packages') | 52 ..packagesFileUri = Uri.base.resolve('.packages') |
| 53 ..compileSdk = true | |
| 54 ..linkedDependencies = [platform] | 53 ..linkedDependencies = [platform] |
| 55 ..setExitCodeOnProblem = true | 54 ..setExitCodeOnProblem = true |
| 56 ..verify = true | 55 ..verify = true; |
| 57 ..sdkRoot = Uri.parse(sdkPath); | |
| 58 | 56 |
| 59 List<int> kernelBinary = | 57 List<int> kernelBinary = |
| 60 serializeProgram(await kernelForProgram(uri, options)); | 58 serializeProgram(await kernelForProgram(uri, options)); |
| 61 CompilerImpl compiler = compilerFor( | 59 CompilerImpl compiler = compilerFor( |
| 62 entryPoint: entryPoint, | 60 entryPoint: entryPoint, |
| 63 memorySourceFiles: {'main.dill': kernelBinary}, | 61 memorySourceFiles: {'main.dill': kernelBinary}, |
| 64 diagnosticHandler: diagnostics, | 62 diagnosticHandler: diagnostics, |
| 65 outputProvider: output, | 63 outputProvider: output, |
| 66 options: [Flags.useKernel]); | 64 options: [Flags.useKernel]); |
| 67 await compiler.setupSdk(); | 65 await compiler.setupSdk(); |
| 68 await compiler.libraryLoader.loadLibrary(entryPoint); | 66 await compiler.libraryLoader.loadLibrary(entryPoint); |
| 69 | 67 |
| 70 Expect.equals(0, diagnostics.errors.length); | 68 Expect.equals(0, diagnostics.errors.length); |
| 71 Expect.equals(0, diagnostics.warnings.length); | 69 Expect.equals(0, diagnostics.warnings.length); |
| 72 | 70 |
| 73 ElementEnvironment environment = | 71 ElementEnvironment environment = |
| 74 compiler.frontendStrategy.elementEnvironment; | 72 compiler.frontendStrategy.elementEnvironment; |
| 75 LibraryEntity library = environment.lookupLibrary(uri); | 73 LibraryEntity library = environment.lookupLibrary(uri); |
| 76 Expect.isNotNull(library); | 74 Expect.isNotNull(library); |
| 77 ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest'); | 75 ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest'); |
| 78 Expect.isNotNull(clss); | 76 Expect.isNotNull(clss); |
| 79 var member = environment.lookupClassMember(clss, 'testMain'); | 77 var member = environment.lookupClassMember(clss, 'testMain'); |
| 80 Expect.isNotNull(member); | 78 Expect.isNotNull(member); |
| 81 }); | 79 }); |
| 82 } | 80 } |
| OLD | NEW |