If you're pasting blocks of prewritten code into the REPL, you don't want it to double-indent. Saying ':autoindent off' before you paste now disables the automatic indentation so you can paste preformatted code.
Swift SVN r4222
Rerender inputs in bold after they've been entered. Colorize non-REPL output, cyan for normal responses, and green for REPL directive responses. (In my terminal setup these were the least retina-searing members of the vast and nuanced ANSI color palette.)
Swift SVN r4217
Package up some useful REPL context into a header-able REPLContext class. Move the response metavar index there instead of having it as a gross mutable static variable.
Swift SVN r4203
If a REPL input parses to an expression, bind it to the next available variable 'r<n>', and print the result as if it were a name binding. Don't bind a variable if the expression consists of a lone DeclRef, and don't print the binding if it has void type.
Swift SVN r4201
Document how we're relying on the synchronous-ness of CFMessagePortSendRequest to serialize AST access between the REPLInput and REPLEnvironment threads, and remove an inaccurate comment about EL_GETCFN.
Swift SVN r4178
The REPL was accreting global_ctors and rerunning all global initializers ever registered before every entry. Change it so that it only runs global initializers once and so that the ObjC initialization stuff that needs to happen on a per-entry basis just gets dropped directly into the main() for each entry.
Swift SVN r4154
In the repl, if a replExit function is defined, call it when the repl is exiting. In the stdlib, add an atREPLExit function that pushes replExit handlers onto a vector and a replExit function that invokes those handlers. In swiftAppKit, have REPLApplicationMain use atREPLExit to terminate the application when the REPL is exited.
Swift SVN r4132
This runs the REPL with the editline interactor in a separate thread while the main thread runs a CFRunLoop. The interactor thread then sends REPL inputs through a CFMessagePort which the main thread run loop responds to.
Swift SVN r4128
Break out the code that actually puts together an editline input from the code that parses, compiles, and executes the code, with an eye toward letting the former run in a thread while the latter becomes a CFRunLoop client.
Swift SVN r4124
If the completion prefix has a '.' behind it, guesstimate a context expression by lexing backward through an identifier(.identifier)* dotted path, then attempt to parse and typecheck that expression to decide on a base type in which to find completions.
Swift SVN r4063
Implement a 'lookupVisibleDecls' API similar to Clang's that replicates the UnqualifiedLookup logic for walking through a given scope looking for decls. Use it to populate the completion list in the repl.
Still to be done: Clang module lookup via Clang's lookupVisibleDecls, and context deduction from dotted path expressions.
Swift SVN r4056
Actually indent the source lines we receive from editline when we store them to the buffer so that :dump_source looks right. Fixes <rdar://problem/13171743>.
Swift SVN r3983
Set up a Completion object to extract context and a prefix string from a partial input and then track the state of the user's interaction with the completion system. Wire up tab in editline to trigger completion when pressed. It still needs to be hooked up to name lookup; right now it just looks in a fixed list of completion strings.
Swift SVN r3981
In theory this would colorize the prompt, but editline is broken and doesn't emit literal-mode characters in sequence with cooked characters.
Swift SVN r3973
When an Objective-C class is first used, the runtime will "realize" it,
i.e. create the rw-data and set a couple flags. With pure Swift classes,
though, it's possible to create an instance and then send a message to it
without ever sending a message to the class, in which case the runtime will
try to realize the /instance/ and mess everything up.
This patch "fixes" that by sending the +load message to all Swift classes,
to make sure they get realized before being used. This is a very
unfortunate cost in startup time but will be necessary for id-compatibility.
I will admit that I'm not sure why this is necessary for compiled classes.
I would have expected the object file to contain the necessary information
for the runtime to realize the classes in it by default. But perhaps
classes aren't realized until their first class message even in statically-
compiled code.
<rdar://problem/13154445>
Swift SVN r3951
This allows you to print imported structs that were defined as 'typedef struct foo {} foo;', for which the original decl is otherwise inaccessible:
swift> :print_decl NSFastEnumerationState
typealias NSFastEnumerationState = NSFastEnumerationState
struct NSFastEnumerationState {
...
}
Swift SVN r3922
The lexer now models tuples, patterns, subscripting, function calls, and
field access robustly. The output tokens are now better named as well:
l_paren and l_paren_call, and l_square and l_square_subscript. It
should be much more clear now which one to use. Also, the use of
l_paren or l_square will not arbitrarily flip flop if the token before
it is a keyword or if the token before it was the trailing ']' of an
attribute list. Similarly, tuples will always cause the lexer to produce
l_paren, regardless if the user typed '((x,y))' or '( (x,y))'.
When we someday add array literals, the right token is now naturally
falling out of the lexer.
Swift SVN r3840
Update everywhere in Swift that refers to this module accordingly.
This change is backwards-incompatible and will require rebuilding any
Objective-C-based object files. I recommend a clean of swiftFoundation
and NSStringDemo at the very least. The swiftObjC target is also being
renamed to swiftObjectiveC for consistency.
Swift SVN r3784
Will allow immediate execution through SIL-irgen when SIL-irgen actually exists. Also add NeedsOutput_{First,Last} symbols to the ActionType enum so that the insidious enum ordering significance there is more obvious.
Swift SVN r3757
It doesn't do anything but crash yet. Also add an entry point fo SILGen to Subsystems so that it can be invoked without dependency on SIL or SILGen.
Swift SVN r3738
This change allows client code to just use, e.g.,
import Foundation
to get both the Clang Foundation module and the Swift Foundation
module that provides various adaptation (typically via
extensions). At some point later, we can consider whether the modules
will end up in different namespaces somehow, or whether this is best
tackled by some kind of module re-export directive, but for now it's
convenient while we await the design of a real module system for
Swift.
Swift SVN r3405
When generating IR for the JIT, use sel_registerName() to unique the
selector references we generate. Static code doesn't need this
pessimization. Fixes <rdar://problem/12764732>.
Swift SVN r3403
This is a horrible, hard-coded hack so that the REPL and interpreter
will get the ObjC bridging definitions from the SwiftFoundation dylib
when the SwiftFoundation module is imported.
Swift SVN r3402