Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:collection' show HashSet, Queue; | 5 import 'dart:collection' show HashSet, Queue; |
| 6 import 'dart:convert' show BASE64, JSON, UTF8; | 6 import 'dart:convert' show BASE64, JSON, UTF8; |
| 7 import 'dart:io' show File; | 7 import 'dart:io' show File; |
| 8 import 'package:analyzer/dart/element/element.dart' show LibraryElement; | 8 import 'package:analyzer/dart/element/element.dart' show LibraryElement; |
| 9 import 'package:analyzer/analyzer.dart' | 9 import 'package:analyzer/analyzer.dart' |
| 10 show AnalysisError, CompilationUnit, ErrorSeverity; | 10 show AnalysisError, CompilationUnit, ErrorSeverity; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 resourceProvider: resourceProvider); | 90 resourceProvider: resourceProvider); |
| 91 | 91 |
| 92 var context = createAnalysisContext(); | 92 var context = createAnalysisContext(); |
| 93 context.sourceFactory = srcFactory; | 93 context.sourceFactory = srcFactory; |
| 94 context.typeProvider = sdkResolver.dartSdk.context.typeProvider; | 94 context.typeProvider = sdkResolver.dartSdk.context.typeProvider; |
| 95 context.resultProvider = | 95 context.resultProvider = |
| 96 new InputPackagesResultProvider(context, summaryData); | 96 new InputPackagesResultProvider(context, summaryData); |
| 97 options.declaredVariables.forEach(context.declaredVariables.define); | 97 options.declaredVariables.forEach(context.declaredVariables.define); |
| 98 context.declaredVariables.define('dart.isVM', 'false'); | 98 context.declaredVariables.define('dart.isVM', 'false'); |
| 99 | 99 |
| 100 // TODO(vsm): Should this be hardcoded? | |
| 101 context.declaredVariables.define('dart.library.html', 'true'); | |
| 102 context.declaredVariables.define('dart.library.io', 'false'); | |
|
vsm
2016/12/14 16:20:28
FYI - I verified that the tests print "html". Wit
| |
| 103 | |
| 100 return new ModuleCompiler.withContext(context, summaryData); | 104 return new ModuleCompiler.withContext(context, summaryData); |
| 101 } | 105 } |
| 102 | 106 |
| 103 bool _isFatalError(AnalysisError e, CompilerOptions options) { | 107 bool _isFatalError(AnalysisError e, CompilerOptions options) { |
| 104 if (errorSeverity(context, e) != ErrorSeverity.ERROR) return false; | 108 if (errorSeverity(context, e) != ErrorSeverity.ERROR) return false; |
| 105 | 109 |
| 106 // These errors are not fatal in the REPL compile mode as we | 110 // These errors are not fatal in the REPL compile mode as we |
| 107 // allow access to private members across library boundaries | 111 // allow access to private members across library boundaries |
| 108 // and those accesses will show up as undefined members unless | 112 // and those accesses will show up as undefined members unless |
| 109 // additional analyzer changes are made to support them. | 113 // additional analyzer changes are made to support them. |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 // Fall back to a relative path. | 558 // Fall back to a relative path. |
| 555 return path.toUri(path.relative(path.fromUri(uri), from: dir)).toString(); | 559 return path.toUri(path.relative(path.fromUri(uri), from: dir)).toString(); |
| 556 } | 560 } |
| 557 | 561 |
| 558 for (int i = 0; i < list.length; i++) { | 562 for (int i = 0; i < list.length; i++) { |
| 559 list[i] = transformUri(list[i]); | 563 list[i] = transformUri(list[i]); |
| 560 } | 564 } |
| 561 map['file'] = transformUri(map['file']); | 565 map['file'] = transformUri(map['file']); |
| 562 return map; | 566 return map; |
| 563 } | 567 } |
| OLD | NEW |