Last active
October 20, 2016 23:20
-
-
Save munificent/34836067f26b8bc0161de57590a33115 to your computer and use it in GitHub Desktop.
Using `(params) -> return` syntax.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Uses in typedefs. | |
typedef CompilerInputProvider = Uri->Future/*<String | List<int>>*/; | |
typedef ReadStringFromUri = Uri->Future<String>; | |
typedef CompilerOutputProvider = (String name, String extension) -> EventSink<String>; | |
typedef DiagnosticHandler = | |
(Uri, int begin, int end, String message, Diagnostic kind) -> void; | |
typedef PackagesDiscoveryProvider = Uri->Future<Packages>; | |
// Uses in parameters and fields. | |
class _DeferredAction { | |
final Element element; | |
final ()->void action; | |
_DeferredAction(this.element, this.action); | |
} | |
/// If [DEBUG_PRINT_ENABLED] is `true` print [s] using the current identation. | |
(dynamic s) -> void get debugPrint { | |
enableDebugMode(); | |
// TODO(johnniwinther): Maybe disable debug mode after the call. | |
return _debugPrint; | |
} | |
/// Use this to get a tree-like debug printout for nested calls. | |
(dynamic s, ()->dynamic f) -> dynamic get debugWrapPrint { | |
enableDebugMode(); | |
return _debugWrapPrint; | |
} | |
/// Print a message with a source location. | |
(DiagnosticReporter, Spannable node, String debugMessage) -> dynamic | |
get reportHere { | |
enableDebugMode(); | |
return _reportHere; | |
} | |
(String message, {(String stackTrace) -> bool condition, int limit, | |
bool throwOnPrint}) -> void | |
get trace { | |
enableDebugMode(); | |
return _trace; | |
} | |
void _trace(String message, | |
{(String stackTrace) -> bool condition, int limit, | |
bool throwOnPrint: false}) { | |
... | |
} | |
/// Implementation of [traceAndReport]. | |
void _traceAndReport( | |
DiagnosticReporter reporter, Spannable node, String message, | |
{(String stackTrace) -> bool condition, int limit, | |
bool throwOnPrint: false}) { | |
trace(message, limit: limit, throwOnPrint: throwOnPrint, | |
condition: (String stackTrace) { | |
... | |
}); | |
} | |
void emitNoSuchMethodHandlers( | |
(jsAst.Name, jsAst.Expression) -> jsAst.Property addProperty) { | |
ClassStubGenerator generator = | |
new ClassStubGenerator(compiler, namer, backend); | |
... | |
} | |
void _generateIsTestsOn( | |
ClassElement cls, | |
(Element) -> void generateIsTest, | |
(Element method, FunctionType methodType) -> void | |
generateFunctionTypeSignature, | |
(Element, {bool emitNull}) -> void generateSubstitution, | |
void emitTypeCheck(TypeCheck check)) { | |
Setlet<Element> generated = new Setlet<Element>(); | |
... | |
} | |
void _generateInterfacesIsTests( | |
ClassElement cls, | |
ClassElement -> void generateIsTest, | |
(Element, {bool emitNull}) -> void generateSubstitution, | |
Set<Element> alreadyGenerated) { | |
... | |
} | |
/// Similar to [resetAsync] but [reuseLibrary] maps all libraries to a list | |
/// of libraries that can be reused. | |
Future<Null> resetLibraries( | |
(Iterable<LibraryElement>) -> Future<Iterable<LibraryElement>> | |
reuseLibraries); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment