| OLD | NEW |
| 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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
| 10 import 'closure.dart' as closureMapping show ClosureTask; | 10 import 'closure.dart' as closureMapping show ClosureTask; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return _codegenWorldBuilder; | 288 return _codegenWorldBuilder; |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool get analyzeAll => options.analyzeAll || compileAll; | 291 bool get analyzeAll => options.analyzeAll || compileAll; |
| 292 | 292 |
| 293 bool get compileAll => false; | 293 bool get compileAll => false; |
| 294 | 294 |
| 295 bool get disableTypeInference => | 295 bool get disableTypeInference => |
| 296 options.disableTypeInference || compilationFailed; | 296 options.disableTypeInference || compilationFailed; |
| 297 | 297 |
| 298 // TODO(het): remove this from here. Either inline at all use sites or add it | |
| 299 // to Reporter. | |
| 300 void unimplemented(Spannable spannable, String methodName) { | |
| 301 reporter.internalError(spannable, "$methodName not implemented."); | |
| 302 } | |
| 303 | |
| 304 // Compiles the dart script at [uri]. | 298 // Compiles the dart script at [uri]. |
| 305 // | 299 // |
| 306 // The resulting future will complete with true if the compilation | 300 // The resulting future will complete with true if the compilation |
| 307 // succeeded. | 301 // succeeded. |
| 308 Future<bool> run(Uri uri) => selfTask.measureSubtask("Compiler.run", () { | 302 Future<bool> run(Uri uri) => selfTask.measureSubtask("Compiler.run", () { |
| 309 measurer.startWallClock(); | 303 measurer.startWallClock(); |
| 310 | 304 |
| 311 return new Future.sync(() => runInternal(uri)) | 305 return new Future.sync(() => runInternal(uri)) |
| 312 .catchError((error) => _reporter.onError(uri, error)) | 306 .catchError((error) => _reporter.onError(uri, error)) |
| 313 .whenComplete(() { | 307 .whenComplete(() { |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 } | 914 } |
| 921 registerCompileTimeError(currentElement, message); | 915 registerCompileTimeError(currentElement, message); |
| 922 } | 916 } |
| 923 | 917 |
| 924 /** | 918 /** |
| 925 * Reads the script specified by the [readableUri]. | 919 * Reads the script specified by the [readableUri]. |
| 926 * | 920 * |
| 927 * See [LibraryLoader] for terminology on URIs. | 921 * See [LibraryLoader] for terminology on URIs. |
| 928 */ | 922 */ |
| 929 Future<Script> readScript(Uri readableUri, [Spannable node]) { | 923 Future<Script> readScript(Uri readableUri, [Spannable node]) { |
| 930 unimplemented(node, 'Compiler.readScript'); | 924 throw new SpannableAssertionFailure( |
| 931 return null; | 925 node, 'Compiler.readScript not implemented.'); |
| 932 } | 926 } |
| 933 | 927 |
| 934 Element lookupElementIn(ScopeContainerElement container, String name) { | 928 Element lookupElementIn(ScopeContainerElement container, String name) { |
| 935 Element element = container.localLookup(name); | 929 Element element = container.localLookup(name); |
| 936 if (element == null) { | 930 if (element == null) { |
| 937 throw 'Could not find $name in $container'; | 931 throw 'Could not find $name in $container'; |
| 938 } | 932 } |
| 939 return element; | 933 return element; |
| 940 } | 934 } |
| 941 | 935 |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 bool isDeferredLoadLibraryGetter(MemberElement member) { | 1982 bool isDeferredLoadLibraryGetter(MemberElement member) { |
| 1989 return member.isDeferredLoaderGetter; | 1983 return member.isDeferredLoaderGetter; |
| 1990 } | 1984 } |
| 1991 | 1985 |
| 1992 @override | 1986 @override |
| 1993 ResolutionFunctionType getFunctionType(MethodElement method) { | 1987 ResolutionFunctionType getFunctionType(MethodElement method) { |
| 1994 method.computeType(_resolution); | 1988 method.computeType(_resolution); |
| 1995 return method.type; | 1989 return method.type; |
| 1996 } | 1990 } |
| 1997 } | 1991 } |
| OLD | NEW |