mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In order to do this, we need to save and restore parser state easily. The important pieces of state are: * lexer position; * lexical scope stack. Lexer position can be saved/restored easily. We don't need to store the tokens for the function body because swift does not have a preprocessor and we can easily re-lex everything we need. We just store the lexer state for the beginning and the end of the body. To save the lexical scope stack, we had to change the underlying data structure. Originally, the parser used the ScopedHashTable, which supports only a stack of scopes. But we need a *tree* of scopes. I implemented TreeScopedHashTable based on ScopedHashTable. It has an optimization for pushing/popping scopes in a stack fashion -- these scopes will not be allocated on the heap. While ‘detached’ scopes that we want to re-enter later, and all their parent scopes, are moved to the heap. In parseIntoTranslationUnit() we do a second pass over the 'structural AST' that does not contain function bodies to actually parse them from saved token ranges. Swift SVN r5886
19 lines
673 B
Makefile
19 lines
673 B
Makefile
##===- unittests/Basic/Makefile ----------------------------*- Makefile -*-===##
|
|
#
|
|
# This source file is part of the Swift.org open source project
|
|
#
|
|
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
# Licensed under Apache License v2.0 with Runtime Library Exception
|
|
#
|
|
# See http://swift.org/LICENSE.txt for license information
|
|
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
#
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
SWIFT_LEVEL = ../..
|
|
TESTNAME = Basic
|
|
include $(SWIFT_LEVEL)/../../Makefile.config
|
|
LINK_COMPONENTS := $(TARGETS_TO_BUILD)
|
|
|
|
include $(SWIFT_LEVEL)/unittests/Makefile
|