aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-05 17:47:02 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-05 17:47:02 -0300
commit1ab2b93462753b5f500ada31353acc444d4e7b7c (patch)
tree0934f3891707f446c3b0d57ba7827243bc1f6e22 /lparser.c
parent6cf85dcc900c71687678bc316164142e76df7385 (diff)
downloadlua-1ab2b93462753b5f500ada31353acc444d4e7b7c.tar.gz
lua-1ab2b93462753b5f500ada31353acc444d4e7b7c.tar.bz2
lua-1ab2b93462753b5f500ada31353acc444d4e7b7c.zip
debug information for last line of a function definition
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lparser.c b/lparser.c
index afb07061..e27c669f 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 2.23 2005/05/04 16:36:23 roberto Exp roberto $ 2** $Id: lparser.c,v 2.24 2005/05/04 20:42:28 roberto Exp roberto $
3** Lua Parser 3** Lua Parser
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -87,10 +87,10 @@ static void error_expected (LexState *ls, int token) {
87 87
88 88
89static void errorlimit (FuncState *fs, int limit, const char *what) { 89static void errorlimit (FuncState *fs, int limit, const char *what) {
90 const char *msg = (fs->f->lineDefined == 0) ? 90 const char *msg = (fs->f->linedefined == 0) ?
91 luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : 91 luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) :
92 luaO_pushfstring(fs->L, "function at line %d has more than %d %s", 92 luaO_pushfstring(fs->L, "function at line %d has more than %d %s",
93 fs->f->lineDefined, limit, what); 93 fs->f->linedefined, limit, what);
94 luaX_lexerror(fs->ls, msg, 0); 94 luaX_lexerror(fs->ls, msg, 0);
95} 95}
96 96
@@ -591,7 +591,7 @@ static void body (LexState *ls, expdesc *e, int needself, int line) {
591 /* body -> `(' parlist `)' chunk END */ 591 /* body -> `(' parlist `)' chunk END */
592 FuncState new_fs; 592 FuncState new_fs;
593 open_func(ls, &new_fs); 593 open_func(ls, &new_fs);
594 new_fs.f->lineDefined = line; 594 new_fs.f->linedefined = line;
595 checknext(ls, '('); 595 checknext(ls, '(');
596 if (needself) { 596 if (needself) {
597 new_localvarliteral(ls, "self", 0); 597 new_localvarliteral(ls, "self", 0);
@@ -600,6 +600,7 @@ static void body (LexState *ls, expdesc *e, int needself, int line) {
600 parlist(ls); 600 parlist(ls);
601 checknext(ls, ')'); 601 checknext(ls, ')');
602 chunk(ls); 602 chunk(ls);
603 new_fs.f->lastlinedefined = ls->linenumber;
603 check_match(ls, TK_END, TK_FUNCTION, line); 604 check_match(ls, TK_END, TK_FUNCTION, line);
604 close_func(ls); 605 close_func(ls);
605 pushclosure(ls, &new_fs, e); 606 pushclosure(ls, &new_fs, e);